@Test public void testTimeConsistencyJoinGroup() throws UnknownMasterException, DatabaseException { createGroup(); ReplicatedEnvironment masterRep = repEnvInfo[0].getEnv(); assertEquals(State.MASTER, masterRep.getState()); leaveGroupAllButMaster(); /* Populates just the master. */ populateDB(masterRep, TEST_DB_NAME, 1000); repEnvInfo[1].openEnv( new TimeConsistencyPolicy( 1, TimeUnit.MILLISECONDS, RepTestUtils.MINUTE_MS, TimeUnit.MILLISECONDS)); ReplicatedEnvironmentStats stats = repEnvInfo[1].getEnv().getRepStats(StatsConfig.DEFAULT); assertEquals(1, stats.getTrackerLagConsistencyWaits()); assertTrue(stats.getTrackerLagConsistencyWaitMs() > 0); }
@Override public void run() { try { ReplicatedEnvironment repenv = replicator.openEnv( new CommitPointConsistencyPolicy( commitToken, RepTestUtils.MINUTE_MS, TimeUnit.MILLISECONDS)); assertEquals(ReplicatedEnvironment.State.REPLICA, repenv.getState()); ReplicatedEnvironmentStats stats = replicator.getEnv().getRepStats(StatsConfig.DEFAULT); assertEquals(1, stats.getTrackerVLSNConsistencyWaits()); assertTrue(stats.getTrackerVLSNConsistencyWaitMs() > 0); } catch (UnknownMasterException e) { testException = e; throw new RuntimeException(e); } catch (DatabaseException e) { testException = e; throw new RuntimeException(e); } }