Search in sources :

Example 1 with DoubleBufferEntry

use of org.apache.hadoop.ozone.om.ratis.helpers.DoubleBufferEntry in project ozone by apache.

the class OzoneManagerDoubleBuffer method addCleanupEntry.

private void addCleanupEntry(DoubleBufferEntry entry, Map<String, List<Long>> cleanupEpochs) {
    Class<? extends OMClientResponse> responseClass = entry.getResponse().getClass();
    CleanupTableInfo cleanupTableInfo = responseClass.getAnnotation(CleanupTableInfo.class);
    if (cleanupTableInfo != null) {
        String[] cleanupTables;
        if (cleanupTableInfo.cleanupAll()) {
            cleanupTables = Arrays.stream(new OMDBDefinition().getColumnFamilies()).map(DBColumnFamilyDefinition::getTableName).toArray(String[]::new);
        } else {
            cleanupTables = cleanupTableInfo.cleanupTables();
        }
        for (String table : cleanupTables) {
            cleanupEpochs.computeIfAbsent(table, list -> new ArrayList<>()).add(entry.getTrxLogIndex());
        }
    } else {
        // add CleanupTableInfo annotation.
        throw new RuntimeException("CleanupTableInfo Annotation is missing " + "for" + responseClass);
    }
}
Also used : TransactionInfo(org.apache.hadoop.hdds.utils.TransactionInfo) Arrays(java.util.Arrays) TRANSACTION_INFO_KEY(org.apache.hadoop.ozone.OzoneConsts.TRANSACTION_INFO_KEY) LoggerFactory(org.slf4j.LoggerFactory) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) CleanupTableInfo(org.apache.hadoop.ozone.om.response.CleanupTableInfo) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) ArrayList(java.util.ArrayList) OMClientResponse(org.apache.hadoop.ozone.om.response.OMClientResponse) Map(java.util.Map) OMResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse) BatchOperation(org.apache.hadoop.hdds.utils.db.BatchOperation) Logger(org.slf4j.Logger) DoubleBufferEntry(org.apache.hadoop.ozone.om.ratis.helpers.DoubleBufferEntry) IOException(java.io.IOException) SupplierWithIOException(org.apache.hadoop.hdds.function.SupplierWithIOException) OMDBDefinition(org.apache.hadoop.ozone.om.codec.OMDBDefinition) Collectors(java.util.stream.Collectors) Daemon(org.apache.hadoop.util.Daemon) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) TracingUtil(org.apache.hadoop.hdds.tracing.TracingUtil) ExitUtils(org.apache.ratis.util.ExitUtils) DBColumnFamilyDefinition(org.apache.hadoop.hdds.utils.db.DBColumnFamilyDefinition) Time(org.apache.hadoop.util.Time) Preconditions(com.google.common.base.Preconditions) Queue(java.util.Queue) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Collections(java.util.Collections) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) OMMetadataManager(org.apache.hadoop.ozone.om.OMMetadataManager) OzoneManagerDoubleBufferMetrics(org.apache.hadoop.ozone.om.ratis.metrics.OzoneManagerDoubleBufferMetrics) OMDBDefinition(org.apache.hadoop.ozone.om.codec.OMDBDefinition) DBColumnFamilyDefinition(org.apache.hadoop.hdds.utils.db.DBColumnFamilyDefinition) ArrayList(java.util.ArrayList) CleanupTableInfo(org.apache.hadoop.ozone.om.response.CleanupTableInfo)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions (com.google.common.base.Preconditions)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Queue (java.util.Queue)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 SupplierWithIOException (org.apache.hadoop.hdds.function.SupplierWithIOException)1 TracingUtil (org.apache.hadoop.hdds.tracing.TracingUtil)1 TransactionInfo (org.apache.hadoop.hdds.utils.TransactionInfo)1