Search in sources :

Example 1 with Session

use of org.apache.accumulo.tserver.session.Session in project accumulo by apache.

the class TabletServer method markUnusedWALs.

private void markUnusedWALs() {
    List<DfsLogger> closedCopy;
    synchronized (closedLogs) {
        closedCopy = copyClosedLogs(closedLogs);
    }
    ReferencedRemover refRemover = candidates -> {
        for (Tablet tablet : getOnlineTablets().values()) {
            tablet.removeInUseLogs(candidates);
            if (candidates.isEmpty()) {
                break;
            }
        }
    };
    Set<DfsLogger> eligible = findOldestUnreferencedWals(closedCopy, refRemover);
    try {
        TServerInstance session = this.getTabletSession();
        for (DfsLogger candidate : eligible) {
            log.info("Marking " + candidate.getPath() + " as unreferenced");
            walMarker.walUnreferenced(session, candidate.getPath());
        }
        synchronized (closedLogs) {
            closedLogs.removeAll(eligible);
        }
    } catch (WalMarkerException ex) {
        log.info(ex.toString(), ex);
    }
}
Also used : VolumeChooserEnvironmentImpl(org.apache.accumulo.server.fs.VolumeChooserEnvironmentImpl) Arrays(java.util.Arrays) TableInfo(org.apache.accumulo.core.master.thrift.TableInfo) Text(org.apache.hadoop.io.Text) Iface(org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Iface) TServer(org.apache.thrift.server.TServer) GarbageCollectionLogger(org.apache.accumulo.server.GarbageCollectionLogger) TServerInstance(org.apache.accumulo.core.metadata.TServerInstance) SecureRandom(java.security.SecureRandom) TabletLevel(org.apache.accumulo.server.TabletLevel) Map(java.util.Map) RootTable(org.apache.accumulo.core.metadata.RootTable) ServerBulkImportStatus(org.apache.accumulo.server.util.ServerBulkImportStatus) ThriftServerType(org.apache.accumulo.server.rpc.ThriftServerType) DfsLogger(org.apache.accumulo.tserver.log.DfsLogger) ServerAddress(org.apache.accumulo.server.rpc.ServerAddress) BulkImportState(org.apache.accumulo.core.master.thrift.BulkImportState) SortedLogState(org.apache.accumulo.server.log.SortedLogState) EnumSet(java.util.EnumSet) Property(org.apache.accumulo.core.conf.Property) InstanceId(org.apache.accumulo.core.data.InstanceId) TServiceClient(org.apache.thrift.TServiceClient) VolumeManager(org.apache.accumulo.server.fs.VolumeManager) Compactable(org.apache.accumulo.tserver.compactions.Compactable) Set(java.util.Set) RelativeTime(org.apache.accumulo.server.util.time.RelativeTime) ServerServices(org.apache.accumulo.core.util.ServerServices) NodeExistsPolicy(org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy) AuthenticationTokenSecretManager(org.apache.accumulo.server.security.delegation.AuthenticationTokenSecretManager) ServiceLock(org.apache.accumulo.fate.zookeeper.ServiceLock) AuditedSecurityOperation(org.apache.accumulo.server.security.AuditedSecurityOperation) UtilWaitThread.sleepUninterruptibly(org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly) TProcessor(org.apache.thrift.TProcessor) LogSorter(org.apache.accumulo.tserver.log.LogSorter) HostAndPort(org.apache.accumulo.core.util.HostAndPort) SecurityOperation(org.apache.accumulo.server.security.SecurityOperation) Threads(org.apache.accumulo.core.util.threads.Threads) AbstractServer(org.apache.accumulo.server.AbstractServer) DurabilityImpl(org.apache.accumulo.core.clientImpl.DurabilityImpl) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) MetricsUtil(org.apache.accumulo.core.metrics.MetricsUtil) DistributedWorkQueue(org.apache.accumulo.server.zookeeper.DistributedWorkQueue) WalMarkerException(org.apache.accumulo.server.log.WalStateManager.WalMarkerException) SessionManager(org.apache.accumulo.tserver.session.SessionManager) CommitSession(org.apache.accumulo.tserver.tablet.CommitSession) ManagementFactory(java.lang.management.ManagementFactory) Service(org.apache.accumulo.core.util.ServerServices.Service) FILES(org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.FILES) LinkedHashSet(java.util.LinkedHashSet) BlockingDeque(java.util.concurrent.BlockingDeque) ServerContext(org.apache.accumulo.server.ServerContext) KeyExtent(org.apache.accumulo.core.dataImpl.KeyExtent) TException(org.apache.thrift.TException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) AtomicLong(java.util.concurrent.atomic.AtomicLong) TreeMap(java.util.TreeMap) LinkedBlockingDeque(java.util.concurrent.LinkedBlockingDeque) LockWatcher(org.apache.accumulo.fate.zookeeper.ServiceLock.LockWatcher) FileSystemMonitor(org.apache.accumulo.server.util.FileSystemMonitor) TableId(org.apache.accumulo.core.data.TableId) RetryFactory(org.apache.accumulo.fate.util.Retry.RetryFactory) ServerOpts(org.apache.accumulo.server.ServerOpts) ThriftUtil(org.apache.accumulo.core.rpc.ThriftUtil) LockLossReason(org.apache.accumulo.fate.zookeeper.ServiceLock.LockLossReason) TabletData(org.apache.accumulo.tserver.tablet.TabletData) SortedSet(java.util.SortedSet) ZooCache(org.apache.accumulo.fate.zookeeper.ZooCache) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) TabletsMetadata(org.apache.accumulo.core.metadata.schema.TabletsMetadata) TCredentialsUpdatingWrapper(org.apache.accumulo.server.rpc.TCredentialsUpdatingWrapper) LoggerFactory(org.slf4j.LoggerFactory) LRUMap(org.apache.commons.collections4.map.LRUMap) MetadataTable(org.apache.accumulo.core.metadata.MetadataTable) ManagerMessage(org.apache.accumulo.tserver.managermessage.ManagerMessage) RecoveryPath(org.apache.accumulo.server.manager.recovery.RecoveryPath) TServerUtils(org.apache.accumulo.server.rpc.TServerUtils) ComparablePair(org.apache.accumulo.core.util.ComparablePair) TabletServerLogger(org.apache.accumulo.tserver.log.TabletServerLogger) ScanRunState(org.apache.accumulo.tserver.scan.ScanRunState) ReplicationServicer(org.apache.accumulo.core.replication.thrift.ReplicationServicer) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Path(org.apache.hadoop.fs.Path) TabletServerUpdateMetrics(org.apache.accumulo.tserver.metrics.TabletServerUpdateMetrics) TabletServerScanMetrics(org.apache.accumulo.tserver.metrics.TabletServerScanMetrics) PREV_ROW(org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.PREV_ROW) SecurityUtil(org.apache.accumulo.server.security.SecurityUtil) Operation(org.apache.accumulo.tserver.TabletStatsKeeper.Operation) Collection(java.util.Collection) TabletServerMetrics(org.apache.accumulo.tserver.metrics.TabletServerMetrics) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Durability(org.apache.accumulo.core.client.Durability) Processor(org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Processor) ThreadPools(org.apache.accumulo.core.util.threads.ThreadPools) UUID(java.util.UUID) Session(org.apache.accumulo.tserver.session.Session) WalStateManager(org.apache.accumulo.server.log.WalStateManager) SplitReportMessage(org.apache.accumulo.tserver.managermessage.SplitReportMessage) MapCounter(org.apache.accumulo.core.util.MapCounter) List(java.util.List) TableConfiguration(org.apache.accumulo.server.conf.TableConfiguration) Pair(org.apache.accumulo.core.util.Pair) Entry(java.util.Map.Entry) TraceUtil(org.apache.accumulo.core.trace.TraceUtil) SortedMap(java.util.SortedMap) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) UtilWaitThread(org.apache.accumulo.fate.util.UtilWaitThread) HashMap(java.util.HashMap) Iterators(com.google.common.collect.Iterators) HashSet(java.util.HashSet) TabletLocator(org.apache.accumulo.core.clientImpl.TabletLocator) TabletResourceManager(org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager) TabletServerMinCMetrics(org.apache.accumulo.tserver.metrics.TabletServerMinCMetrics) ZooAuthenticationKeyWatcher(org.apache.accumulo.server.security.delegation.ZooAuthenticationKeyWatcher) Halt(org.apache.accumulo.core.util.Halt) ManagerClientService(org.apache.accumulo.core.manager.thrift.ManagerClientService) ZooReaderWriter(org.apache.accumulo.fate.zookeeper.ZooReaderWriter) CompactionManager(org.apache.accumulo.tserver.compactions.CompactionManager) LogEntry(org.apache.accumulo.core.tabletserver.log.LogEntry) Retry(org.apache.accumulo.fate.util.Retry) CompactionWatcher(org.apache.accumulo.server.compaction.CompactionWatcher) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) ReentrantLock(java.util.concurrent.locks.ReentrantLock) KeeperException(org.apache.zookeeper.KeeperException) UTF_8(java.nio.charset.StandardCharsets.UTF_8) VolumeChooserEnvironment(org.apache.accumulo.core.spi.fs.VolumeChooserEnvironment) CompactionExecutorsMetrics(org.apache.accumulo.tserver.metrics.CompactionExecutorsMetrics) Compacting(org.apache.accumulo.core.master.thrift.Compacting) BulkImportCacheCleaner(org.apache.accumulo.tserver.tablet.BulkImportCacheCleaner) Constants(org.apache.accumulo.core.Constants) TimeUnit(java.util.concurrent.TimeUnit) ECOMP(org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.ECOMP) MutationReceiver(org.apache.accumulo.tserver.log.MutationReceiver) Tablet(org.apache.accumulo.tserver.tablet.Tablet) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Collections(java.util.Collections) LOGS(org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.LOGS) Tablet(org.apache.accumulo.tserver.tablet.Tablet) TServerInstance(org.apache.accumulo.core.metadata.TServerInstance) DfsLogger(org.apache.accumulo.tserver.log.DfsLogger) WalMarkerException(org.apache.accumulo.server.log.WalStateManager.WalMarkerException)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Iterators (com.google.common.collect.Iterators)1 IOException (java.io.IOException)1 ManagementFactory (java.lang.management.ManagementFactory)1 UnknownHostException (java.net.UnknownHostException)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 SecureRandom (java.security.SecureRandom)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 EnumSet (java.util.EnumSet)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Set (java.util.Set)1