Search in sources :

Example 1 with KeyPrefixFilter

use of org.apache.hadoop.hdds.utils.MetadataKeyFilters.KeyPrefixFilter in project ozone by apache.

the class TestStorageContainerManagerHelper method getPendingDeletionBlocks.

public List<String> getPendingDeletionBlocks(Long containerID) throws IOException {
    List<String> pendingDeletionBlocks = Lists.newArrayList();
    ReferenceCountedDB meta = getContainerMetadata(containerID);
    KeyPrefixFilter filter = new KeyPrefixFilter().addFilter(OzoneConsts.DELETING_KEY_PREFIX);
    List<? extends Table.KeyValue<String, BlockData>> kvs = meta.getStore().getBlockDataTable().getRangeKVs(null, Integer.MAX_VALUE, filter);
    for (Table.KeyValue<String, BlockData> entry : kvs) {
        pendingDeletionBlocks.add(entry.getKey().replace(OzoneConsts.DELETING_KEY_PREFIX, ""));
    }
    meta.close();
    return pendingDeletionBlocks;
}
Also used : Table(org.apache.hadoop.hdds.utils.db.Table) BlockData(org.apache.hadoop.ozone.container.common.helpers.BlockData) KeyPrefixFilter(org.apache.hadoop.hdds.utils.MetadataKeyFilters.KeyPrefixFilter) ReferenceCountedDB(org.apache.hadoop.ozone.container.common.utils.ReferenceCountedDB)

Aggregations

KeyPrefixFilter (org.apache.hadoop.hdds.utils.MetadataKeyFilters.KeyPrefixFilter)1 Table (org.apache.hadoop.hdds.utils.db.Table)1 BlockData (org.apache.hadoop.ozone.container.common.helpers.BlockData)1 ReferenceCountedDB (org.apache.hadoop.ozone.container.common.utils.ReferenceCountedDB)1