/** * Try to initialize the Configuration and TransactionStateStorage instances. Obtaining the Configuration may * fail until ReactorServiceMain has been started. */ private void tryInit() { try { Configuration conf = getSnapshotConfiguration(); if (conf != null) { // Since this is only used for background loading of transaction snapshots, we use the no-op metrics collector, // as there are no relevant metrics to report this.storage = new HDFSTransactionStateStorage(conf, new SnapshotCodecProvider(conf), new TxMetricsCollector()); this.storage.startAndWait(); this.snapshotRefreshFrequency = conf.getLong(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, TxConstants.Manager.DEFAULT_TX_SNAPSHOT_INTERVAL) * 1000; this.initialized = true; } else { LOG.info("Could not load configuration"); } } catch (Exception e) { LOG.info("Failed to initialize TransactionStateCache due to: " + e.getMessage()); } }
/** * Try to initialize the Configuration and TransactionStateStorage instances. Obtaining the Configuration may * fail until ReactorServiceMain has been started. */ private void tryInit() { try { Configuration conf = getSnapshotConfiguration(); if (conf != null) { // Since this is only used for background loading of transaction snapshots, we use the no-op metrics collector, // as there are no relevant metrics to report this.storage = new HDFSTransactionStateStorage(conf, new SnapshotCodecProvider(conf), new TxMetricsCollector()); this.storage.startAndWait(); this.snapshotRefreshFrequency = conf.getLong(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, TxConstants.Manager.DEFAULT_TX_SNAPSHOT_INTERVAL) * 1000; this.initialized = true; } else { LOG.info("Could not load configuration"); } } catch (Exception e) { LOG.info("Failed to initialize TransactionStateCache due to: " + e.getMessage()); } }
@Override protected AbstractTransactionStateStorage getStorage(Configuration conf) { return new HDFSTransactionStateStorage(conf, new SnapshotCodecProvider(conf), new TxMetricsCollector()); } }
@Override protected AbstractTransactionStateStorage getStorage(Configuration conf) { return new LocalFileTransactionStateStorage(conf, new SnapshotCodecProvider(conf), new TxMetricsCollector()); }
@Before public void before() { conf.setInt(TxConstants.Manager.CFG_TX_CLEANUP_INTERVAL, 0); // no cleanup thread // todo should create two sets of tests, one with LocalFileTxStateStorage and one with InMemoryTxStateStorage txStateStorage = new InMemoryTransactionStateStorage(); txManager = new TransactionManager (conf, txStateStorage, new TxMetricsCollector()); txManager.startAndWait(); }
@BeforeClass public static void before() { txManager = new TransactionManager(conf, new InMemoryTransactionStateStorage(), new TxMetricsCollector()); txManager.startAndWait(); }
new HDFSTransactionStateStorage(config, new SnapshotCodecProvider(config), new TxMetricsCollector()); storage.startAndWait(); try {
new HDFSTransactionStateStorage(config, new SnapshotCodecProvider(config), new TxMetricsCollector()); storage.startAndWait(); try {
@BeforeClass public static void setupBeforeClass() throws Exception { Configuration hConf = new Configuration(); hConf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, TMP_FOLDER.newFolder().getAbsolutePath()); dfsCluster = new MiniDFSCluster.Builder(hConf).numDataNodes(1).build(); conf = new Configuration(dfsCluster.getFileSystem().getConf()); metricsCollector = new TxMetricsCollector(); }
storage1 = getStorage(conf); TransactionManager txManager = new TransactionManager (conf, storage1, new TxMetricsCollector()); txManager.startAndWait(); txManager = new TransactionManager(conf, storage2, new TxMetricsCollector()); txManager.startAndWait();
long longTimeout = TimeUnit.SECONDS.toMillis(conf.getLong(TxConstants.Manager.CFG_TX_LONG_TIMEOUT, TxConstants.Manager.DEFAULT_TX_LONG_TIMEOUT)); TransactionManager txm = new TransactionManager(conf, storage, new TxMetricsCollector()); txm.startAndWait(); try {
(conf, new InMemoryTransactionStateStorage(), new TxMetricsCollector()); txm.startAndWait(); try {
TransactionManager txm = new TransactionManager(conf, storage, new TxMetricsCollector()); txm.startAndWait(); try {
TransactionManager txm = new TransactionManager(conf, storage, new TxMetricsCollector()); txm.startAndWait(); try {
TransactionManager txm1 = new TransactionManager(testConf, storage, new TxMetricsCollector()); txm1.startAndWait(); txm2 = new TransactionManager(testConf, storage, new TxMetricsCollector()); txm2.startAndWait(); Assert.assertEquals(ImmutableList.of(tx5.getTransactionId(), tx6.getTransactionId()),
storage = getStorage(conf); TransactionManager txManager = new TransactionManager (conf, storage, new TxMetricsCollector()); txManager.startAndWait(); txManager = new TransactionManager(conf, storage2, new TxMetricsCollector()); txManager.startAndWait(); txManager = new TransactionManager(conf, storage3, new TxMetricsCollector()); txManager.startAndWait();
TransactionManager txm = new TransactionManager(conf, storage, new TxMetricsCollector()); txm.startAndWait(); try {
TransactionManager txm1 = new TransactionManager(testConf, storage, new TxMetricsCollector()); txm1.startAndWait(); txm2 = new TransactionManager(testConf, storage, new TxMetricsCollector()); txm2.startAndWait(); Assert.assertEquals(ImmutableList.of(tx2.getTransactionId(), tx5.getTransactionId()),
(conf, new InMemoryTransactionStateStorage(), new TxMetricsCollector()); txm.startAndWait(); try {