@Override public void run() { OracleClient oclient = env.getSharedResources().getOracleClient(); for (int i = 0; i < numToGet; i++) { try { output.add(oclient.getStamp().getTxTimestamp()); } catch (Exception e) { e.printStackTrace(); } } cdl.countDown(); } }
private synchronized void close(boolean checkForStaleScan) { if (status != TxStatus.CLOSED) { status = TxStatus.CLOSED; if (checkForStaleScan && !commitAttempted) { Stamp stamp = env.getSharedResources().getOracleClient().getStamp(); if (startTs < stamp.getGcTimestamp()) { throw new StaleScanException(); } } env.getSharedResources().getTimestampTracker().removeTimestamp(startTs); } }
@Override public void close() { if (closed.compareAndSet(false, true)) { // wait for queue to empty and prevent anything else from being enqueued semaphore.acquireUninterruptibly(semaphoreSize); // wait for all asynchronously committing transactions to complete commiting.waitUntilZero(); if (executor != null) { executor.shutdown(); while (!executor.isTerminated()) { try { executor.awaitTermination(3, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } } } if (exceptionRef.get() != null) { throw new RuntimeException(exceptionRef.get()); } // wait for any async mutations that transactions write to flush env.getSharedResources().getBatchWriter().waitForAsyncFlush(); } } }
public synchronized TimestampTracker getTimestampTracker() { checkIfClosed(); if (tsTracker == null) { tsTracker = new TimestampTracker(env, getTransactorID()); } return tsTracker; }
public CommitData createCommitData() { CommitData cd = new CommitData(); cd.cw = env.getSharedResources().getConditionalWriter(); cd.acw = env.getSharedResources().getAsyncConditionalWriter(); cd.bacw = env.getSharedResources().getBulkAsyncConditionalWriter(); return cd; }
cd = tx5.createCommitData(); Assert.assertTrue(tx5.preCommit(cd)); Stamp commitTs = env.getSharedResources().getOracleClient().getStamp(); Assert.assertTrue(tx5.commitPrimaryColumn(cd, commitTs)); env.getSharedResources().getBatchWriter().waitForAsyncFlush(); iter = scanner.iterator(); Assert.assertFalse(iter.hasNext());
private int getNumOpen() throws Exception { return env.getSharedResources().getCurator().getChildren() .forPath(ZookeeperPath.TRANSACTOR_NODES).size(); }
private static Stamp allocateTimestamp(Environment env) { return env.getSharedResources().getTimestampTracker().allocateTimestamp(); }
CuratorFramework curator = env.getSharedResources().getCurator(); curator.setData().forPath(env.getSharedResources().getTimestampTracker().getNodePath(), LongUtil.toByteArray(nextTs)); Thread.sleep(500); curator.setData().forPath(env.getSharedResources().getTimestampTracker().getNodePath(), LongUtil.toByteArray(nextTs)); gcTs = ZookeeperUtil.getGcTimestamp(config.getAppZookeepers());
TransactorCache transactorCache = env.getSharedResources().getTransactorCache(); TxInfoCache txiCache = env.getSharedResources().getTxInfoCache(); Set<Entry<PrimaryRowColumn, List<LockInfo>>> es = groupedLocks.entrySet(); for (Entry<PrimaryRowColumn, List<LockInfo>> group : es) { env.getSharedResources().getBatchWriter().writeMutations(new ArrayList<>(mutations.values()));
public synchronized String getMetricsReporterID() { if (metricsReporterID == null) { String mid = System.getProperty(MetricNames.METRICS_REPORTER_ID_PROP); if (mid == null) { try { String hostname = InetAddress.getLocalHost().getHostName(); int idx = hostname.indexOf('.'); if (idx > 0) { hostname = hostname.substring(0, idx); } mid = hostname + "_" + getSharedResources().getTransactorID(); } catch (UnknownHostException e) { throw new RuntimeException(e); } } metricsReporterID = mid.replace('.', '_'); } return metricsReporterID; }
public ConditionalWriter createConditionalWriter() throws TableNotFoundException { return new FaultyConditionalWriter(super.getSharedResources().getConditionalWriter(), up, wp); } }
GcTimestampTracker() throws Exception { this.curator = env.getSharedResources().getCurator(); }
private static Stamp allocateTimestamp(Environment env) { return env.getSharedResources().getTimestampTracker().allocateTimestamp(); }
public synchronized TimestampTracker getTimestampTracker() { checkIfClosed(); if (tsTracker == null) { tsTracker = new TimestampTracker(env, getTransactorID()); } return tsTracker; }
public CommitData createCommitData() { CommitData cd = new CommitData(); cd.cw = env.getSharedResources().getConditionalWriter(); cd.acw = env.getSharedResources().getAsyncConditionalWriter(); cd.bacw = env.getSharedResources().getBulkAsyncConditionalWriter(); return cd; }
TransactorCache transactorCache = env.getSharedResources().getTransactorCache(); TxInfoCache txiCache = env.getSharedResources().getTxInfoCache(); Set<Entry<PrimaryRowColumn, List<LockInfo>>> es = groupedLocks.entrySet(); for (Entry<PrimaryRowColumn, List<LockInfo>> group : es) { env.getSharedResources().getBatchWriter().writeMutations(new ArrayList<>(mutations.values()));
public synchronized String getMetricsReporterID() { if (metricsReporterID == null) { String mid = System.getProperty(MetricNames.METRICS_REPORTER_ID_PROP); if (mid == null) { try { String hostname = InetAddress.getLocalHost().getHostName(); int idx = hostname.indexOf('.'); if (idx > 0) { hostname = hostname.substring(0, idx); } mid = hostname + "_" + getSharedResources().getTransactorID(); } catch (UnknownHostException e) { throw new RuntimeException(e); } } metricsReporterID = mid.replace('.', '_'); } return metricsReporterID; }
private static boolean rollbackPrimary(Environment env, long startTs, PrimaryRowColumn prc, byte[] lockValue) { // TODO review use of PrewriteIter here IteratorSetting iterConf = new IteratorSetting(10, PrewriteIterator.class); PrewriteIterator.setSnaptime(iterConf, startTs); ConditionalFlutation delLockMutation = new ConditionalFlutation(env, prc.prow, new FluoCondition(env, prc.pcol).setIterators(iterConf).setValue(lockValue)); delLockMutation.put(prc.pcol, ColumnConstants.DEL_LOCK_PREFIX | prc.startTs, DelLockValue.encodeRollback(true, true)); ConditionalWriter cw = null; cw = env.getSharedResources().getConditionalWriter(); // TODO handle other conditional writer cases try { return cw.write(delLockMutation).getStatus() == Status.ACCEPTED; } catch (AccumuloException e) { throw new RuntimeException(e); } catch (AccumuloSecurityException e) { throw new RuntimeException(e); } }
private Stamp getTimestamp() { return env.getSharedResources().getOracleClient().getStamp(); }