public static void main(String[] args) throws Exception { TestRollingLevelDBTimelineStore store = new TestRollingLevelDBTimelineStore(); store.setup(); store.testStorePerformance(); store.tearDown(); } }
@Before public void setup() throws Exception { fsContext = FileContext.getLocalFSFileContext(); fsPath = new File("target", this.getClass().getSimpleName() + "-tmpDir").getAbsoluteFile(); fsContext.delete(new Path(fsPath.getAbsolutePath()), true); config.set(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_PATH, fsPath.getAbsolutePath()); config.setBoolean(YarnConfiguration.TIMELINE_SERVICE_TTL_ENABLE, false); store = new RollingLevelDBTimelineStore(); store.init(config); store.start(); loadTestEntityData(); loadVerificationEntityData(); loadTestDomainData(); }
newConfig.setLong(YarnConfiguration.TIMELINE_SERVICE_TTL_MS, 0); config = newConfig; restartTimelineStore(); Assert.fail(); } catch (IllegalArgumentException e) { YarnConfiguration.TIMELINE_SERVICE_LEVELDB_TTL_INTERVAL_MS, 0); config = newConfig; restartTimelineStore(); Assert.fail(); } catch (IllegalArgumentException e) { YarnConfiguration.TIMELINE_SERVICE_LEVELDB_READ_CACHE_SIZE, -1); config = newConfig; restartTimelineStore(); Assert.fail(); } catch (IllegalArgumentException e) { 0); config = newConfig; restartTimelineStore(); Assert.fail(); } catch (IllegalArgumentException e) { 0); config = newConfig; restartTimelineStore(); Assert.fail(); } catch (IllegalArgumentException e) {
@Test public void testGetSingleEntity() throws IOException { super.testGetSingleEntity(); ((RollingLevelDBTimelineStore)store).clearStartTimeCache(); super.testGetSingleEntity(); loadTestEntityData(); }
@Test public void testCheckVersion() throws IOException { RollingLevelDBTimelineStore dbStore = (RollingLevelDBTimelineStore) store; // default version Version defaultVersion = dbStore.getCurrentVersion(); Assert.assertEquals(defaultVersion, dbStore.loadVersion()); // compatible version Version compatibleVersion = Version.newInstance(defaultVersion.getMajorVersion(), defaultVersion.getMinorVersion() + 2); dbStore.storeVersion(compatibleVersion); Assert.assertEquals(compatibleVersion, dbStore.loadVersion()); restartTimelineStore(); dbStore = (RollingLevelDBTimelineStore) store; // overwrite the compatible version Assert.assertEquals(defaultVersion, dbStore.loadVersion()); // incompatible version Version incompatibleVersion = Version.newInstance(defaultVersion.getMajorVersion() + 1, defaultVersion.getMinorVersion()); dbStore.storeVersion(incompatibleVersion); try { restartTimelineStore(); Assert.fail("Incompatible version, should expect fail here."); } catch (ServiceStateException e) { Assert.assertTrue("Exception message mismatch", e.getMessage().contains("Incompatible version for timeline store")); } }