@Override public Configuration getConfiguration() { return env.getConfiguration(); }
public TimestampTracker(Environment env, TransactorID tid) { this(env, tid, env.getConfiguration().getLong(FluoConfigurationImpl.ZK_UPDATE_PERIOD_PROP, FluoConfigurationImpl.ZK_UPDATE_PERIOD_MS_DEFAULT)); }
void start() throws Exception { advertisedGcTimetamp = LongUtil.fromByteArray(curator.getData().forPath(ZookeeperPath.ORACLE_GC_TIMESTAMP)); TimerTask tt = new TimerTask() { @Override public void run() { try { updateGcTimestamp(); } catch (Exception e) { log.warn("Failed to update GC timestamp.", e); } } }; timer = new Timer("Oracle gc update timer", true); long updatePeriod = env.getConfiguration().getLong(FluoConfigurationImpl.ZK_UPDATE_PERIOD_PROP, FluoConfigurationImpl.ZK_UPDATE_PERIOD_MS_DEFAULT); timer.schedule(tt, updatePeriod, updatePeriod); }
ScanTask(HashNotificationFinder hashWorkFinder, Environment env, AtomicBoolean stopped) { this.hwf = hashWorkFinder; this.tabletInfoCache = new TabletInfoCache<TabletData, Supplier<TabletData>>(env, new Supplier<TabletData>() { @Override public TabletData get() { return new TabletData(); } }); this.env = env; this.stopped = stopped; minSleepTime = env.getConfiguration().getInt(FluoConfigurationImpl.MIN_SLEEP_TIME_PROP, FluoConfigurationImpl.MIN_SLEEP_TIME_DEFAULT); maxSleepTime = env.getConfiguration().getInt(FluoConfigurationImpl.MAX_SLEEP_TIME_PROP, FluoConfigurationImpl.MAX_SLEEP_TIME_DEFAULT); }
env.getConfiguration().getString(FluoConfigurationImpl.METRICS_RESERVOIR_PROP, hdrSnapshotClass); if ((allReporters.size() > 1) && (clazz.equals(hdrSnapshotClass))) {
public OracleClient(Environment env) { this.env = env; responseTimer = MetricsUtil.getTimer(env.getConfiguration(), env.getSharedResources().getMetricRegistry(), env.getMetricNames().getOracleResponseTime()); stampsHistogram = MetricsUtil.getHistogram(env.getConfiguration(), env.getSharedResources() .getMetricRegistry(), env.getMetricNames().getOracleClientStamps()); timestampRetriever = new TimestampRetriever(); thread = new Thread(timestampRetriever); thread.setDaemon(true); thread.start(); }
public NotificationProcessor(Environment env) { int numThreads = env.getConfiguration().getWorkerThreads(); this.env = env; this.queue = new LinkedBlockingQueue<>(); this.executor = new ThreadPoolExecutor(numThreads, numThreads, 0L, TimeUnit.MILLISECONDS, queue); this.tracker = new NotificationTracker(); this.observers = new Observers(env); env.getSharedResources().getMetricRegistry() .register(env.getMetricNames().getNotificationQueued(), new Gauge<Integer>() { @Override public Integer getValue() { return queue.size(); } }); }
private InetSocketAddress startServer() throws TTransportException { if (env.getConfiguration().containsKey(FluoConfigurationImpl.ORACLE_PORT_PROP)) { port = env.getConfiguration().getInt(FluoConfigurationImpl.ORACLE_PORT_PROP); Preconditions.checkArgument(port >= 1 && port <= 65535, FluoConfigurationImpl.ORACLE_PORT_PROP + " must be valid port (1-65535)"); } else { port = PortUtils.getRandomFreePort(); } InetSocketAddress addr = new InetSocketAddress(port); TNonblockingServerSocket socket = new TNonblockingServerSocket(addr); THsHaServer.Args serverArgs = new THsHaServer.Args(socket); TProcessor processor = new OracleService.Processor<OracleService.Iface>(this); serverArgs.processor(processor); serverArgs.maxReadBufferBytes = ORACLE_MAX_READ_BUFFER_BYTES; serverArgs.inputProtocolFactory(new TCompactProtocol.Factory()); serverArgs.outputProtocolFactory(new TCompactProtocol.Factory()); server = new THsHaServer(serverArgs); Runnable st = new Runnable() { @Override public void run() { server.serve(); } }; serverThread = new Thread(st); serverThread.setDaemon(true); serverThread.start(); return addr; }
queue.add(tr); try { int timeout = env.getConfiguration().getClientRetryTimeout(); if (timeout < 0) { long waitPeriod = 1;
public void report(String status, Class<?> execClass) { MetricNames names = env.getMetricNames(); MetricRegistry registry = env.getSharedResources().getMetricRegistry(); String sn = execClass.getSimpleName(); if (getLockWaitTime() > 0) { MetricsUtil.getTimer(env.getConfiguration(), registry, names.getTxLockWaitTime() + sn) .update(getLockWaitTime(), TimeUnit.MILLISECONDS); } MetricsUtil.getTimer(env.getConfiguration(), registry, names.getTxExecTime() + sn).update( getTime(), TimeUnit.MILLISECONDS); if (getCollisions() > 0) { registry.meter(names.getTxWithCollision() + sn).mark(); registry.meter(names.getTxCollisions() + sn).mark(getCollisions()); } registry.meter(names.getTxEntriesSet() + sn).mark(getEntriesSet()); registry.meter(names.getTxEntriesRead() + sn).mark(getEntriesReturned()); if (getTimedOutLocks() > 0) { registry.meter(names.getTxLocksTimedout() + sn).mark(getTimedOutLocks()); } if (getDeadLocks() > 0) { registry.meter(names.getTxLocksDead() + sn).mark(getDeadLocks()); } registry.meter(names.getTxStatus() + status.toLowerCase() + "." + sn).mark(); }
log.info("Starting Oracle for Fluo '{}' application with the following configuration:", config.getApplicationName()); env.getConfiguration().print();
public synchronized void start() throws Exception { if (started) { throw new IllegalStateException(); } final InetSocketAddress addr = startServer(); curatorFramework = CuratorUtil.newAppCurator(env.getConfiguration()); curatorFramework.getConnectionStateListenable().addListener(cnxnListener); curatorFramework.start(); while (!cnxnListener.isConnected()) { Thread.sleep(200); } leaderSelector = new LeaderSelector(curatorFramework, ZookeeperPath.ORACLE_SERVER, this); String leaderId = HostUtil.getHostName() + ":" + addr.getPort(); leaderSelector.setId(leaderId); log.info("Leader ID = " + leaderId); leaderSelector.start(); pathChildrenCache = new PathChildrenCache(curatorFramework, oraclePath, true); pathChildrenCache.getListenable().addListener(this); pathChildrenCache.start(); while (!cnxnListener.isConnected()) { Thread.sleep(200); } log.info("Listening " + addr); started = true; }
log.info("Starting Worker for Fluo '{}' application with the following configuration:", config.getApplicationName()); env.getConfiguration().print(); NotificationFinderFactory.newNotificationFinder(env.getConfiguration()); notificationFinder.init(env, np); notificationFinder.start();
public OracleServer(Environment env) throws Exception { this.env = env; stampsHistogram = MetricsUtil.getHistogram(env.getConfiguration(), env.getSharedResources() .getMetricRegistry(), env.getMetricNames().getOracleServerStamps()); this.cnxnListener = new CuratorCnxnListener(); this.maxTsPath = ZookeeperPath.ORACLE_MAX_TIMESTAMP; this.oraclePath = ZookeeperPath.ORACLE_SERVER; }
if (System.currentTimeMillis() - startTime > env.getConfiguration() .getTransactionRollbackTime()) { locksToRecover = locks;
curatorFramework = CuratorUtil.newAppCurator(env.getConfiguration()); CuratorCnxnListener cnxnListener = new CuratorCnxnListener(); curatorFramework.getConnectionStateListenable().addListener(cnxnListener);
public SharedResources(Environment env) throws TableNotFoundException { this.env = env; curator = CuratorUtil.newAppCurator(env.getConfiguration()); curator.start(); int numTservers = env.getConnector().instanceOperations().getTabletServers().size(); int numBWThreads = FluoConfigurationImpl.getNumBWThreads(env.getConfiguration(), numTservers); bw = env.getConnector().createBatchWriter(env.getTable(), new BatchWriterConfig().setMaxWriteThreads(numBWThreads)); sbw = new SharedBatchWriter(bw); int numCWThreads = FluoConfigurationImpl.getNumCWThreads(env.getConfiguration(), numTservers); cw = env.getConnector().createConditionalWriter( env.getTable(), new ConditionalWriterConfig().setAuthorizations(env.getAuthorizations()) .setMaxWriteThreads(numCWThreads)); bulkCw = env.getConnector().createConditionalWriter( env.getTable(), new ConditionalWriterConfig().setAuthorizations(env.getAuthorizations()) .setMaxWriteThreads(numCWThreads)); txInfoCache = new TxInfoCache(env); visCache = new VisibilityCache(); metricRegistry = new MetricRegistry(); }
public MiniFluoImpl(FluoConfiguration fluoConfig) { if (!fluoConfig.hasRequiredMiniFluoProps()) { throw new IllegalArgumentException("MiniFluo configuration is not valid"); } config = fluoConfig; try { if (config.getMiniStartAccumulo()) { startMiniAccumulo(); } config.setProperty(FluoConfigurationImpl.MIN_SLEEP_TIME_PROP, 50); config.setProperty(FluoConfigurationImpl.MAX_SLEEP_TIME_PROP, 100); env = new Environment(config); reporter = FluoClientImpl.setupReporters(env, "mini", reporterCounter); oserver = new OracleServer(env); oserver.start(); mnp = new MiniNotificationProcessor(env); notificationFinder = NotificationFinderFactory.newNotificationFinder(env.getConfiguration()); notificationFinder.init(env, mnp); notificationFinder.start(); } catch (Exception e) { throw new RuntimeException(e); } }