private DfsLogger(ServerContext context, ServerResources conf) { this.context = context; this.conf = conf; this.slowFlushMillis = conf.getConfiguration() .getTimeInMillis(Property.TSERV_SLOW_FLUSH_MILLIS); }
/** * Gets the delay before the first collection. * * @return start delay, in milliseconds */ long getStartDelay() { return getConfiguration().getTimeInMillis(Property.GC_CYCLE_START); }
void waitUntilCommitsAreEnabled() { if (holdCommits) { long timeout = System.currentTimeMillis() + conf.getSystemConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT); synchronized (commitHold) { while (holdCommits) { try { if (System.currentTimeMillis() > timeout) throw new HoldTimeoutException("Commits are held"); commitHold.wait(1000); } catch (InterruptedException e) {} } } } }
public SessionManager(AccumuloConfiguration conf) { aconf = conf; maxUpdateIdle = conf.getTimeInMillis(Property.TSERV_UPDATE_SESSION_MAXIDLE); maxIdle = conf.getTimeInMillis(Property.TSERV_SESSION_MAXIDLE); SecureRandom sr; try { // This is faster than the default secure random which uses /dev/urandom sr = SecureRandom.getInstance("SHA1PRNG"); } catch (NoSuchAlgorithmException e) { log.debug("Unable to create SHA1PRNG secure random, using default"); sr = new SecureRandom(); } random = sr; Runnable r = new Runnable() { @Override public void run() { sweep(maxIdle, maxUpdateIdle); } }; SimpleTimer.getInstance(conf).schedule(r, 0, Math.max(maxIdle / 2, 1000)); }
public SimpleGarbageCollector(Opts opts, ServerContext context) { this.context = context; this.opts = opts; this.fs = context.getVolumeManager(); long gcDelay = getConfiguration().getTimeInMillis(Property.GC_CYCLE_DELAY); log.info("start delay: {} milliseconds", getStartDelay()); log.info("time delay: {} milliseconds", gcDelay); log.info("safemode: {}", opts.safeMode); log.info("verbose: {}", opts.verbose); log.info("memory threshold: {} of bytes", CANDIDATE_MEMORY_PERCENTAGE, Runtime.getRuntime().maxMemory()); log.info("delete threads: {}", getNumDeleteThreads()); }
@Override void start(Path bulkDir, Master master, long tid, boolean setTime) throws Exception { super.start(bulkDir, master, tid, setTime); timeInMillis = master.getConfiguration().getTimeInMillis(Property.MASTER_BULK_TIMEOUT); fmtTid = String.format("%016x", tid); loadMsgs = new MapCounter<>(); loadQueue = new HashMap<>(); }
public ZooReaderWriter(AccumuloConfiguration conf) { this(conf.get(Property.INSTANCE_ZK_HOST), (int) conf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT), conf.get(Property.INSTANCE_SECRET)); }
try { startTicketRenewalThread(UserGroupInformation.getCurrentUser(), acuConf.getTimeInMillis(Property.GENERAL_KERBEROS_RENEWAL_PERIOD)); return; } catch (IOException e) {
@Override public void run() { final long millisBeforeWarning = conf .getTimeInMillis(Property.TSERV_ASSIGNMENT_DURATION_WARNING); try { long now = System.currentTimeMillis();
@Override public void run() { log.info("Starting replication work assignment thread using {}", assignerImplName); while (master.stillMaster()) { // Assign the work using the configured implementation try { assigner.assignWork(); } catch (Exception e) { log.error("Error while assigning work", e); } long sleepTime = conf.getTimeInMillis(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP); log.debug("Sleeping {} ms before next work assignment", sleepTime); sleepUninterruptibly(sleepTime, TimeUnit.MILLISECONDS); // After each loop, make sure that the WorkAssigner implementation didn't change configureWorkAssigner(); } } }
private TSummaries handleTimeout(long sessionId) { long timeout = TabletServer.this.getConfiguration() .getTimeInMillis(Property.TSERV_CLIENT_TIMEOUT); sessionManager.removeIfNotAccessed(sessionId, timeout); return new TSummaries(false, sessionId, -1, -1, null); }
if (!dfs.recoverLease(source)) { log.info("Waiting for file to be closed {}", source); return conf.getTimeInMillis(Property.MASTER_LEASE_RECOVERY_WAITING_PERIOD);
/** * * @param dataCache * : underlying file can and should be able to handle a null cache * @param indexCache * : underlying file can and should be able to handle a null cache */ public FileManager(ServerContext context, VolumeManager fs, int maxOpen, Cache<String,Long> fileLenCache, BlockCache dataCache, BlockCache indexCache) { if (maxOpen <= 0) throw new IllegalArgumentException("maxOpen <= 0"); this.context = context; this.dataCache = dataCache; this.indexCache = indexCache; this.fileLenCache = fileLenCache; this.filePermits = new Semaphore(maxOpen, false); this.maxOpen = maxOpen; this.fs = fs; this.openFiles = new HashMap<>(); this.reservedReaders = new HashMap<>(); this.maxIdleTime = context.getConfiguration().getTimeInMillis(Property.TSERV_MAX_IDLE); SimpleTimer.getInstance(context.getConfiguration()).schedule(new IdleFileCloser(), maxIdleTime, maxIdleTime / 2); }
private void checkForHeldServer(SortedMap<TServerInstance,TabletServerStatus> tserverStatus) { TServerInstance instance = null; int crazyHoldTime = 0; int someHoldTime = 0; final long maxWait = getConfiguration().getTimeInMillis(Property.TSERV_HOLD_TIME_SUICIDE); for (Entry<TServerInstance,TabletServerStatus> entry : tserverStatus.entrySet()) { if (entry.getValue().getHoldTime() > 0) { someHoldTime++; if (entry.getValue().getHoldTime() > maxWait) { instance = entry.getKey(); crazyHoldTime++; } } } if (crazyHoldTime == 1 && someHoldTime == 1 && tserverStatus.size() > 1) { log.warn("Tablet server {} exceeded maximum hold time: attempting to kill it", instance); try { TServerConnection connection = tserverSet.getConnection(instance); if (connection != null) connection.fastHalt(masterLock); } catch (TException e) { log.error("{}", e.getMessage(), e); } tserverSet.remove(instance); } }
while (true) { try { sleepUninterruptibly(getConfiguration().getTimeInMillis(Property.TSERV_MAJC_DELAY), TimeUnit.MILLISECONDS);
@Override public void run() { DefaultConfiguration defaultConf = DefaultConfiguration.getInstance(); long defaultDelay = defaultConf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_DELAY); long defaultPeriod = defaultConf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_PERIOD); long delay = conf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_DELAY); long period = conf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_PERIOD); try { DistributedWorkQueue workQueue; if (defaultDelay != delay && defaultPeriod != period) { log.debug("Configuration DistributedWorkQueue with delay and period of {} and {}", delay, period); workQueue = new DistributedWorkQueue( context.getZooKeeperRoot() + ReplicationConstants.ZOO_WORK_QUEUE, conf, delay, period); } else { log.debug("Configuring DistributedWorkQueue with default delay and period"); workQueue = new DistributedWorkQueue( context.getZooKeeperRoot() + ReplicationConstants.ZOO_WORK_QUEUE, conf); } workQueue.startProcessing(new ReplicationProcessor(context, conf, fs), executor); } catch (KeeperException | InterruptedException e) { throw new RuntimeException(e); } } }
.getTimeInMillis(Property.TSERV_CLIENT_TIMEOUT); sessionManager.removeIfNotAccessed(scanID, timeout); List<TKeyValue> results = Collections.emptyList();
/** * Enable tracing by setting up SpanReceivers for the current process. If host name is null, it * will be determined. If service name is null, the simple name of the class will be used. */ public static void enable(String hostname, String service, AccumuloConfiguration conf) { String spanReceivers = conf.get(Property.TRACE_SPAN_RECEIVERS); String zookeepers = conf.get(Property.INSTANCE_ZK_HOST); long timeout = conf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT); String zkPath = conf.get(Property.TRACE_ZK_PATH); Map<String,String> properties = conf .getAllPropertiesWithPrefix(Property.TRACE_SPAN_RECEIVER_PREFIX); enableTracing(hostname, service, spanReceivers, zookeepers, timeout, zkPath, properties); }
if (idleTime < tableConf.getTimeInMillis(Property.TABLE_MAJC_COMPACTALL_IDLETIME)) { return false;
public ClientContext(SingletonReservation reservation, ClientInfo info, AccumuloConfiguration serverConf) { this.info = info; this.hadoopConf = info.getHadoopConf(); zooCache = new ZooCacheFactory().getZooCache(info.getZooKeepers(), info.getZooKeepersSessionTimeOut()); this.serverConf = serverConf; timeoutSupplier = memoizeWithExpiration( () -> getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT)); sslSupplier = memoizeWithExpiration(() -> SslConnectionParams.forClient(getConfiguration())); saslSupplier = memoizeWithExpiration( () -> SaslConnectionParams.from(getConfiguration(), getCredentials().getToken())); this.singletonReservation = Objects.requireNonNull(reservation); this.tableops = new TableOperationsImpl(this); this.namespaceops = new NamespaceOperationsImpl(this, tableops); }