private InDbTimestampBoundStore createTimestampBoundStore(Optional<TableReference> timestampTable, ConnectionManagerAwareDbKvs dbkvs) { return timestampTable .map(tableReference -> InDbTimestampBoundStore.create( dbkvs.getConnectionManager(), tableReference /* Not using the table prefix here, as the tableRef should contain any necessary prefix.*/ )) .orElseGet(() -> InDbTimestampBoundStore.create( dbkvs.getConnectionManager(), AtlasDbConstants.TIMESTAMP_TABLE, dbkvs.getTablePrefix())); } }
private static Callable<Boolean> canCreateKeyValueService() { return () -> { ConnectionManagerAwareDbKvs kvs = null; try { kvs = createKvs(); return kvs.getConnectionManager().getConnection().isValid(5); } catch (Exception ex) { if (ex.getMessage().contains("The connection attempt failed.") || ex.getMessage().contains("the database system is starting up")) { return false; } else { throw ex; } } finally { if (kvs != null) { kvs.close(); } } }; }
@Override protected TimestampBoundStore createTimestampBoundStore() { kvs = DbkvsPostgresTestSuite.createKvs(); return InDbTimestampBoundStore.create( kvs.getConnectionManager(), AtlasDbConstants.TIMESTAMP_TABLE, DbkvsPostgresTestSuite.getKvsConfig().ddl().tablePrefix()); } }
private InDbTimestampBoundStore createTimestampBoundStore(Optional<TableReference> timestampTable, ConnectionManagerAwareDbKvs dbkvs) { return timestampTable .map(tableReference -> InDbTimestampBoundStore.create( dbkvs.getConnectionManager(), tableReference /* Not using the table prefix here, as the tableRef should contain any necessary prefix.*/ )) .orElseGet(() -> InDbTimestampBoundStore.create( dbkvs.getConnectionManager(), AtlasDbConstants.TIMESTAMP_TABLE, dbkvs.getTablePrefix())); } }