public abstract class SQLMetadataConnector extends Object implements MetadataStorageConnector
CONFIG_TABLE_KEY_COLUMN, CONFIG_TABLE_VALUE_COLUMN| Constructor and Description |
|---|
SQLMetadataConnector(com.google.common.base.Supplier<MetadataStorageConnectorConfig> config,
com.google.common.base.Supplier<MetadataStorageTablesConfig> tablesConfigSupplier) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
compareAndSwap(List<MetadataCASUpdate> updates) |
protected boolean |
connectorIsTransientException(Throwable e)
Vendor specific errors that are not covered by
isTransientException(Throwable) |
void |
createAuditTable() |
void |
createConfigTable() |
void |
createConfigTable(String tableName) |
void |
createDataSourceTable() |
void |
createDataSourceTable(String tableName) |
void |
createEntryTable(String tableName) |
void |
createIndex(String tableName,
String indexName,
List<String> indexCols,
Set<String> createdIndexSet)
create index on the table with retry if not already exist, to be called after createTable
|
void |
createLockTable(String tableName,
String entryTypeName) |
void |
createLogTable(String tableName,
String entryTypeName) |
void |
createPendingSegmentsTable() |
void |
createPendingSegmentsTable(String tableName) |
void |
createRulesTable() |
void |
createRulesTable(String tableName) |
void |
createSegmentTable() |
void |
createSegmentTable(String tableName) |
void |
createSupervisorsTable() |
void |
createSupervisorsTable(String tableName) |
void |
createTable(String tableName,
Iterable<String> sql) |
void |
createTaskTables() |
void |
deleteAllRecords(String tableName) |
String |
getCollation()
The character set and collation for case-sensitive nonbinary string comparison
|
MetadataStorageConnectorConfig |
getConfig() |
protected org.apache.commons.dbcp2.BasicDataSource |
getDatasource() |
abstract org.skife.jdbi.v2.DBI |
getDBI() |
ResultSet |
getIndexInfo(DatabaseMetaData databaseMetaData,
String tableName)
Get the ResultSet for indexInfo for given table
|
Set<String> |
getIndexOnTable(String tableName)
Get the Set of the index on given table
|
String |
getPayloadType()
SQL type to use for payload data (e.g.
|
abstract String |
getQuoteString() |
abstract String |
getSerialType()
Auto-incrementing SQL type to use for IDs
Must be an integer type, which values will be automatically set by the database
The resulting string will be interpolated into the table creation statement, e.g.
|
abstract int |
getStreamingFetchSize()
Returns the value that should be passed to statement.setFetchSize to ensure results
are streamed back from the database instead of fetching the entire result set in memory.
|
String |
getValidationQuery() |
protected <T> T |
inReadOnlyTransaction(org.skife.jdbi.v2.TransactionCallback<T> callback) |
Void |
insertOrUpdate(String tableName,
String keyColumn,
String valueColumn,
String key,
byte[] value) |
protected boolean |
isRootCausePacketTooBigException(Throwable t)
Checks if the root cause of the given exception is a PacketTooBigException.
|
boolean |
isTransientException(Throwable e) |
abstract String |
limitClause(int limit) |
byte[] |
lookup(String tableName,
String keyColumn,
String valueColumn,
String key) |
byte[] |
lookupWithHandle(org.skife.jdbi.v2.Handle handle,
String tableName,
String keyColumn,
String valueColumn,
String key) |
protected static org.apache.commons.dbcp2.BasicDataSource |
makeDatasource(MetadataStorageConnectorConfig connectorConfig,
String validationQuery) |
void |
prepareTaskEntryTable(String tableName) |
<T> T |
retryTransaction(org.skife.jdbi.v2.TransactionCallback<T> callback,
int quietTries,
int maxTries) |
<T> T |
retryWithHandle(org.skife.jdbi.v2.tweak.HandleCallback<T> callback) |
<T> T |
retryWithHandle(org.skife.jdbi.v2.tweak.HandleCallback<T> callback,
com.google.common.base.Predicate<Throwable> myShouldRetry) |
boolean |
tableContainsColumn(org.skife.jdbi.v2.Handle handle,
String table,
String column) |
abstract boolean |
tableExists(org.skife.jdbi.v2.Handle handle,
String tableName) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexportTablepublic SQLMetadataConnector(com.google.common.base.Supplier<MetadataStorageConnectorConfig> config, com.google.common.base.Supplier<MetadataStorageTablesConfig> tablesConfigSupplier)
public String getPayloadType()
CREATE TABLE druid_table ( payload NOT NULL, ... ) public String getCollation()
public abstract String getSerialType()
CREATE TABLE druid_table ( id NOT NULL, ... ) public abstract int getStreamingFetchSize()
public abstract String getQuoteString()
public String getValidationQuery()
public abstract boolean tableExists(org.skife.jdbi.v2.Handle handle,
String tableName)
public abstract String limitClause(int limit)
public <T> T retryWithHandle(org.skife.jdbi.v2.tweak.HandleCallback<T> callback,
com.google.common.base.Predicate<Throwable> myShouldRetry)
public <T> T retryWithHandle(org.skife.jdbi.v2.tweak.HandleCallback<T> callback)
public <T> T retryTransaction(org.skife.jdbi.v2.TransactionCallback<T> callback,
int quietTries,
int maxTries)
public final boolean isTransientException(Throwable e)
protected boolean connectorIsTransientException(Throwable e)
isTransientException(Throwable)protected boolean isRootCausePacketTooBigException(Throwable t)
public void createPendingSegmentsTable(String tableName)
public void createDataSourceTable(String tableName)
public void createSegmentTable(String tableName)
public void createRulesTable(String tableName)
public void createConfigTable(String tableName)
public boolean tableContainsColumn(org.skife.jdbi.v2.Handle handle,
String table,
String column)
public void prepareTaskEntryTable(String tableName)
public void createEntryTable(String tableName)
public void createSupervisorsTable(String tableName)
public Void insertOrUpdate(String tableName, String keyColumn, String valueColumn, String key, byte[] value)
insertOrUpdate in interface MetadataStorageConnectorpublic boolean compareAndSwap(List<MetadataCASUpdate> updates)
compareAndSwap in interface MetadataStorageConnectorpublic abstract org.skife.jdbi.v2.DBI getDBI()
public void createDataSourceTable()
createDataSourceTable in interface MetadataStorageConnectorpublic void createPendingSegmentsTable()
createPendingSegmentsTable in interface MetadataStorageConnectorpublic void createSegmentTable()
createSegmentTable in interface MetadataStorageConnectorpublic void createRulesTable()
createRulesTable in interface MetadataStorageConnectorpublic void createConfigTable()
createConfigTable in interface MetadataStorageConnectorpublic void createTaskTables()
createTaskTables in interface MetadataStorageConnectorpublic void createSupervisorsTable()
createSupervisorsTable in interface MetadataStorageConnector@Nullable public byte[] lookup(String tableName, String keyColumn, String valueColumn, String key)
lookup in interface MetadataStorageConnector@Nullable public byte[] lookupWithHandle(org.skife.jdbi.v2.Handle handle, String tableName, String keyColumn, String valueColumn, String key)
public MetadataStorageConnectorConfig getConfig()
protected static org.apache.commons.dbcp2.BasicDataSource makeDatasource(MetadataStorageConnectorConfig connectorConfig, String validationQuery)
protected org.apache.commons.dbcp2.BasicDataSource getDatasource()
protected final <T> T inReadOnlyTransaction(org.skife.jdbi.v2.TransactionCallback<T> callback)
public void createAuditTable()
createAuditTable in interface MetadataStorageConnectorpublic void deleteAllRecords(String tableName)
deleteAllRecords in interface MetadataStorageConnectorpublic Set<String> getIndexOnTable(String tableName)
tableName - name of the table to fetch the index mappublic ResultSet getIndexInfo(DatabaseMetaData databaseMetaData, String tableName) throws SQLException
databaseMetaData - DatabaseMetaDatatableName - Name of tableSQLExceptionpublic void createIndex(String tableName, String indexName, List<String> indexCols, Set<String> createdIndexSet)
tableName - Name of the table to create index onindexName - case-insensitive string index name, it helps to check the existing index on tableindexCols - List of columns to be indexed oncreatedIndexSet - Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.