public String getPrefixedTableName(TableReference tableRef) { return tablePrefix + DbKvs.internalTableName(tableRef); }
private void init() { checkDatabaseVersion(); databaseSpecificInitialization(); createMetadataTable(); }
@Override public void compactInternally(TableReference tableRef) { compactInternally(tableRef, false); }
public static DbKvs create(DbKeyValueServiceConfig config, SqlConnectionSupplier sqlConnSupplier) { DbKvs dbKvs = createNoInit(config.ddl(), sqlConnSupplier); dbKvs.init(); return dbKvs; }
@Override public Multimap<Cell, Long> getAllTimestamps(TableReference tableRef, Set<Cell> cells, long timestamp) { return batchingQueryRunner.runTask( cells, BatchingStrategies.forIterable(), AccumulatorStrategies.forListMultimap(), cellBatch -> runRead(tableRef, table -> doGetAllTimestamps(table, cellBatch, timestamp))); }
@Override public Map<Cell, Long> getLatestTimestamps(TableReference tableRef, Map<Cell, Long> timestampByCell) { return batchingQueryRunner.runTask( timestampByCell, BatchingStrategies.forMap(), AccumulatorStrategies.forMap(), cellBatch -> runRead(tableRef, table -> doGetLatestTimestamps(table, cellBatch))); }
private static DbKvs createPostgres(ExecutorService executor, PostgresDdlConfig config, SqlConnectionSupplier connections) { PostgresPrefixedTableNames prefixedTableNames = new PostgresPrefixedTableNames(config); DbTableFactory tableFactory = new PostgresDbTableFactory(config, prefixedTableNames); TableMetadataCache tableMetadataCache = new TableMetadataCache(tableFactory); CellTsPairLoader cellTsPairLoader = new PostgresCellTsPageLoader( prefixedTableNames, connections); return new DbKvs( executor, config, tableFactory, connections, new ParallelTaskRunner(newFixedThreadPool(config.poolSize()), config.fetchBatchSize()), (conns, tbl, ids) -> Collections.emptyMap(), // no overflow on postgres new PostgresGetRange(prefixedTableNames, connections, tableMetadataCache), new DbKvsGetCandidateCellsForSweeping(cellTsPairLoader)); }
@Override public ClusterAvailabilityStatus getClusterAvailabilityStatus() { try { checkDatabaseVersion(); return ClusterAvailabilityStatus.ALL_AVAILABLE; } catch (DbkvsVersionException e) { return ClusterAvailabilityStatus.TERMINAL; } catch (Exception e) { return ClusterAvailabilityStatus.NO_QUORUM_AVAILABLE; } }
public static ConnectionManagerAwareDbKvs create(DbKeyValueServiceConfig config) { HikariCPConnectionManager connManager = new HikariCPConnectionManager(config.connection()); ReentrantManagedConnectionSupplier connSupplier = new ReentrantManagedConnectionSupplier(connManager); SqlConnectionSupplier sqlConnSupplier = getSimpleTimedSqlConnectionSupplier(connSupplier); return new ConnectionManagerAwareDbKvs(DbKvs.create(config, sqlConnSupplier), connManager, sqlConnSupplier); }
private static DbKvs createOracle(ExecutorService executor, OracleDdlConfig oracleDdlConfig, SqlConnectionSupplier connections) { OracleTableNameGetter tableNameGetter = new OracleTableNameGetter(oracleDdlConfig); OraclePrefixedTableNames prefixedTableNames = new OraclePrefixedTableNames(tableNameGetter); TableValueStyleCache valueStyleCache = new TableValueStyleCache(); OverflowValueLoader overflowValueLoader = new OracleOverflowValueLoader(oracleDdlConfig, tableNameGetter); DbKvsGetRange getRange = new OracleGetRange( connections, overflowValueLoader, tableNameGetter, valueStyleCache, oracleDdlConfig); CellTsPairLoader cellTsPageLoader = new OracleCellTsPageLoader( connections, tableNameGetter, valueStyleCache, oracleDdlConfig); return new DbKvs( executor, oracleDdlConfig, new OracleDbTableFactory(oracleDdlConfig, tableNameGetter, prefixedTableNames, valueStyleCache, PTExecutors.newSingleThreadScheduledExecutor()), connections, new ImmediateSingleBatchTaskRunner(), overflowValueLoader, getRange, new DbKvsGetCandidateCellsForSweeping(cellTsPageLoader)); }
@Override public Multimap<Cell, Long> getAllTimestamps(TableReference tableRef, Set<Cell> cells, long timestamp) { return batchingQueryRunner.runTask( cells, BatchingStrategies.forIterable(), AccumulatorStrategies.forListMultimap(), cellBatch -> runRead(tableRef, table -> doGetAllTimestamps(table, cellBatch, timestamp))); }
public static DbKvs create(DbKeyValueServiceConfig config, SqlConnectionSupplier sqlConnSupplier) { DbKvs dbKvs = createNoInit(config.ddl(), sqlConnSupplier); dbKvs.init(); return dbKvs; }
@Override public Map<Cell, Long> getLatestTimestamps(TableReference tableRef, Map<Cell, Long> timestampByCell) { return batchingQueryRunner.runTask( timestampByCell, BatchingStrategies.forMap(), AccumulatorStrategies.forMap(), cellBatch -> runRead(tableRef, table -> doGetLatestTimestamps(table, cellBatch))); }
private static DbKvs createPostgres(ExecutorService executor, PostgresDdlConfig config, SqlConnectionSupplier connections) { PostgresPrefixedTableNames prefixedTableNames = new PostgresPrefixedTableNames(config); DbTableFactory tableFactory = new PostgresDbTableFactory(config, prefixedTableNames); TableMetadataCache tableMetadataCache = new TableMetadataCache(tableFactory); CellTsPairLoader cellTsPairLoader = new PostgresCellTsPageLoader( prefixedTableNames, connections); return new DbKvs( executor, config, tableFactory, connections, new ParallelTaskRunner(newFixedThreadPool(config.poolSize()), config.fetchBatchSize()), (conns, tbl, ids) -> Collections.emptyMap(), // no overflow on postgres new PostgresGetRange(prefixedTableNames, connections, tableMetadataCache), new DbKvsGetCandidateCellsForSweeping(cellTsPairLoader)); }
@Override public ClusterAvailabilityStatus getClusterAvailabilityStatus() { try { checkDatabaseVersion(); return ClusterAvailabilityStatus.ALL_AVAILABLE; } catch (DbkvsVersionException e) { return ClusterAvailabilityStatus.TERMINAL; } catch (Exception e) { return ClusterAvailabilityStatus.NO_QUORUM_AVAILABLE; } }
public static ConnectionManagerAwareDbKvs create(DbKeyValueServiceConfig config) { HikariCPConnectionManager connManager = new HikariCPConnectionManager(config.connection()); ReentrantManagedConnectionSupplier connSupplier = new ReentrantManagedConnectionSupplier(connManager); SqlConnectionSupplier sqlConnSupplier = getSimpleTimedSqlConnectionSupplier(connSupplier); return new ConnectionManagerAwareDbKvs(DbKvs.create(config, sqlConnSupplier), connManager, sqlConnSupplier); }
private static DbKvs createOracle(ExecutorService executor, OracleDdlConfig oracleDdlConfig, SqlConnectionSupplier connections) { OracleTableNameGetter tableNameGetter = new OracleTableNameGetter(oracleDdlConfig); OraclePrefixedTableNames prefixedTableNames = new OraclePrefixedTableNames(tableNameGetter); TableValueStyleCache valueStyleCache = new TableValueStyleCache(); OverflowValueLoader overflowValueLoader = new OracleOverflowValueLoader(oracleDdlConfig, tableNameGetter); DbKvsGetRange getRange = new OracleGetRange( connections, overflowValueLoader, tableNameGetter, valueStyleCache, oracleDdlConfig); CellTsPairLoader cellTsPageLoader = new OracleCellTsPageLoader( connections, tableNameGetter, valueStyleCache, oracleDdlConfig); return new DbKvs( executor, oracleDdlConfig, new OracleDbTableFactory(oracleDdlConfig, tableNameGetter, prefixedTableNames, valueStyleCache, PTExecutors.newSingleThreadScheduledExecutor()), connections, new ImmediateSingleBatchTaskRunner(), overflowValueLoader, getRange, new DbKvsGetCandidateCellsForSweeping(cellTsPageLoader)); }
public String getPrefixedOverflowTableName(TableReference tableRef) { return overflowTablePrefix + DbKvs.internalTableName(tableRef); }
private void init() { checkDatabaseVersion(); databaseSpecificInitialization(); createMetadataTable(); }
@Override public void compactInternally(TableReference tableRef) { compactInternally(tableRef, false); }