@Override protected int executeTimestampCommand(AtlasDbServices services) { printer.warn( "This CLI has been deprecated. Please use the timestamp/fresh-timestamp endpoint instead."); if (immutable) { timestamp = services.getTransactionManager().getImmutableTimestamp(); printer.info("The immutable timestamp is: {}", SafeArg.of("timestamp", timestamp)); } else { timestamp = services.getTimestampService().getFreshTimestamp(); printer.info("The fresh timestamp is: {}", SafeArg.of("timestamp", timestamp)); } writeTimestampToFileIfSpecified(); if (dateTime) { long timeMillis = KeyValueServicePuncherStore.getMillisForTimestamp( services.getKeyValueService(), timestamp); DateTime dt = new DateTime(timeMillis); String stringTime = ISODateTimeFormat.dateTime().print(dt); printer.info("Wall clock datetime of {} timestamp is: {}", SafeArg.of("timestamp type", immutable ? IMMUTABLE_STRING : FRESH_STRING), SafeArg.of("dateTime", stringTime)); } printer.info("Timestamp command completed succesfully."); return 0; } }
@Override public int execute(AtlasDbServices services) { // test a method on each of the services if (flag1 != null) { services.getKeyValueService().getAllTableNames(); services.getTimestampService().getFreshTimestamp(); services.getLockService().getMinLockedInVersionId("test-client"); services.getTransactionManager().getImmutableTimestamp(); } // test kvs create table if (flag2 != null) { TableReference table = TableReference.createUnsafe(flag2); services.getKeyValueService().createTable(table, AtlasDbConstants.GENERIC_TABLE_METADATA); Preconditions.checkArgument(services.getKeyValueService().getAllTableNames().contains(table), "kvs contains tables %s, but not table %s", services.getKeyValueService().getAllTableNames(), table.getQualifiedName()); services.getKeyValueService().dropTable(table); } return 0; }
@Override protected int executeTimestampCommand(AtlasDbServices services) { printer.warn( "This CLI has been deprecated. Please use the timestamp/fresh-timestamp endpoint instead."); if (immutable) { timestamp = services.getTransactionManager().getImmutableTimestamp(); printer.info("The immutable timestamp is: {}", SafeArg.of("timestamp", timestamp)); } else { timestamp = services.getTimestampService().getFreshTimestamp(); printer.info("The fresh timestamp is: {}", SafeArg.of("timestamp", timestamp)); } writeTimestampToFileIfSpecified(); if (dateTime) { long timeMillis = KeyValueServicePuncherStore.getMillisForTimestamp( services.getKeyValueService(), timestamp); DateTime dt = new DateTime(timeMillis); String stringTime = ISODateTimeFormat.dateTime().print(dt); printer.info("Wall clock datetime of {} timestamp is: {}", SafeArg.of("timestamp type", immutable ? IMMUTABLE_STRING : FRESH_STRING), SafeArg.of("dateTime", stringTime)); } printer.info("Timestamp command completed succesfully."); return 0; } }