Use Tablestore SDK for Java to delete multiple time series metadata entries and obtain errors for failed entries. Deleting metadata does not delete the corresponding time series data.
Prerequisites
Install the Tablestore SDK for Java and initialize a time series client.
Description
Call deleteTimeseriesMeta to delete multiple time series metadata entries by specifying their complete time series identifiers. The operation deletes records only from the metadata index and does not delete existing data in the time series.
public DeleteTimeseriesMetaResponse deleteTimeseriesMeta(DeleteTimeseriesMetaRequest request) throws TableStoreException, ClientException
The following example deletes the metadata of the specified time series from example_timeseries_table and checks failed entries.
Map<String, String> tags = new HashMap<>();
tags.put("region", "cn-hangzhou");
tags.put("host", "host_0");
TimeseriesKey timeseriesKey =
new TimeseriesKey("cpu", "source_0", tags);
DeleteTimeseriesMetaRequest request =
new DeleteTimeseriesMetaRequest("example_timeseries_table");
request.setTimeseriesKeys(Collections.singletonList(timeseriesKey));
DeleteTimeseriesMetaResponse response =
timeseriesClient.deleteTimeseriesMeta(request);
for (DeleteTimeseriesMetaResponse.FailedRowResult result : response.getFailedRows()) {
System.out.println(result.getIndex());
System.out.println(result.getError());
}
Parameters
DeleteTimeseriesMetaRequest contains the following parameters.
|
Name |
Type |
Description |
|
timeseriesTableName (required) |
|
The time series table name. |
|
timeseriesKeys (required) |
|
The non-empty list of identifiers of the time series metadata entries to delete. You can delete multiple entries in a request. |
Time series identifiers
Each element in timeseriesKeys[] is of the TimeseriesKey type and contains the following parameters.
|
Name |
Type |
Description |
|
measurementName (required) |
|
The measurement name. Tablestore SDK for Java 5.17.2 and later allow this parameter to be empty. |
|
dataSource (optional) |
|
The data source identifier, which can be empty. |
|
tags (optional) |
|
The tags as string key-value pairs. If this parameter is not specified, an empty map is used. The complete time series identifiers must match the target metadata entry. |
Response
DeleteTimeseriesMetaResponse contains the following operation-specific field.
|
Field |
Type |
Description |
|
|
|
Call |
Failed entry information
Each element in failedRows[] is of the DeleteTimeseriesMetaResponse.FailedRowResult type and contains the following fields.
|
Field |
Type |
Description |
|
|
|
Call |
|
|
|
Call |