Search in sources :

Example 1 with InitializeStoreFileTrackerProcedure

use of org.apache.hadoop.hbase.regionserver.storefiletracker.InitializeStoreFileTrackerProcedure in project hbase by apache.

the class RollingUpgradeChore method isCompletelyMigrateSFT.

private boolean isCompletelyMigrateSFT(int concurrentCount) {
    Iterator<InitializeStoreFileTrackerProcedure> iter = processingProcs.iterator();
    while (iter.hasNext()) {
        InitializeStoreFileTrackerProcedure proc = iter.next();
        if (procedureExecutor.isFinished(proc.getProcId())) {
            iter.remove();
        }
    }
    // all procedures executed last time are completed.
    if (!processingProcs.isEmpty()) {
        return false;
    }
    Map<String, TableDescriptor> migrateSFTTables;
    try {
        migrateSFTTables = tableDescriptors.getAll().entrySet().stream().filter(entry -> {
            TableDescriptor td = entry.getValue();
            return StringUtils.isEmpty(td.getValue(StoreFileTrackerFactory.TRACKER_IMPL));
        }).limit(concurrentCount).collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
    } catch (IOException e) {
        LOG.warn("Failed to migrate StoreFileTracker", e);
        return false;
    }
    if (migrateSFTTables.isEmpty()) {
        LOG.info("There is no table to migrate StoreFileTracker!");
        return true;
    }
    for (Map.Entry<String, TableDescriptor> entry : migrateSFTTables.entrySet()) {
        TableDescriptor tableDescriptor = entry.getValue();
        InitializeStoreFileTrackerProcedure proc = new InitializeStoreFileTrackerProcedure(procedureExecutor.getEnvironment(), tableDescriptor.getTableName());
        procedureExecutor.submitProcedure(proc);
        processingProcs.add(proc);
    }
    return false;
}
Also used : Logger(org.slf4j.Logger) Iterator(java.util.Iterator) LoggerFactory(org.slf4j.LoggerFactory) InitializeStoreFileTrackerProcedure(org.apache.hadoop.hbase.regionserver.storefiletracker.InitializeStoreFileTrackerProcedure) IOException(java.io.IOException) TableDescriptors(org.apache.hadoop.hbase.TableDescriptors) MasterProcedureEnv(org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv) Collectors(java.util.stream.Collectors) StringUtils(org.apache.commons.lang3.StringUtils) Stoppable(org.apache.hadoop.hbase.Stoppable) ArrayList(java.util.ArrayList) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) InterfaceAudience(org.apache.yetus.audience.InterfaceAudience) ProcedureExecutor(org.apache.hadoop.hbase.procedure2.ProcedureExecutor) StoreFileTrackerFactory(org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory) Map(java.util.Map) Configuration(org.apache.hadoop.conf.Configuration) MasterServices(org.apache.hadoop.hbase.master.MasterServices) TableDescriptor(org.apache.hadoop.hbase.client.TableDescriptor) ScheduledChore(org.apache.hadoop.hbase.ScheduledChore) InitializeStoreFileTrackerProcedure(org.apache.hadoop.hbase.regionserver.storefiletracker.InitializeStoreFileTrackerProcedure) IOException(java.io.IOException) Map(java.util.Map) TableDescriptor(org.apache.hadoop.hbase.client.TableDescriptor)

Aggregations

IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Configuration (org.apache.hadoop.conf.Configuration)1 ScheduledChore (org.apache.hadoop.hbase.ScheduledChore)1 Stoppable (org.apache.hadoop.hbase.Stoppable)1 TableDescriptors (org.apache.hadoop.hbase.TableDescriptors)1 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)1 MasterServices (org.apache.hadoop.hbase.master.MasterServices)1 MasterProcedureEnv (org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv)1 ProcedureExecutor (org.apache.hadoop.hbase.procedure2.ProcedureExecutor)1 InitializeStoreFileTrackerProcedure (org.apache.hadoop.hbase.regionserver.storefiletracker.InitializeStoreFileTrackerProcedure)1 StoreFileTrackerFactory (org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory)1 InterfaceAudience (org.apache.yetus.audience.InterfaceAudience)1 Logger (org.slf4j.Logger)1