@NotThreadSafe public class PostgresSchema extends RelationalDatabaseSchema
PostgresConnector. The schema information contains
the table definitions and the Kafka Connect Schemas for each table, where the
Schema excludes any columns that have been specified in the
configuration.| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
LOGGER |
protected static String |
PUBLIC_SCHEMA_NAME |
private boolean |
readToastableColumns |
private Map<Integer,TableId> |
relationIdToTableId |
private Map<TableId,List<String>> |
tableIdToToastableColumns |
private TypeRegistry |
typeRegistry |
NO_CAPTURED_DATA_COLLECTIONS_WARNING| Modifier | Constructor and Description |
|---|---|
protected |
PostgresSchema(PostgresConnectorConfig config,
TypeRegistry typeRegistry,
Charset databaseCharset,
TopicSelector<TableId> topicSelector)
Create a schema component given the supplied
Postgres connector configuration. |
| Modifier and Type | Method and Description |
|---|---|
void |
applySchemaChangesForTable(int relationId,
Table table)
Applies schema changes for the specified table.
|
private static TableSchemaBuilder |
getTableSchemaBuilder(PostgresConnectorConfig config,
TypeRegistry typeRegistry,
Charset databaseCharset) |
List<String> |
getToastableColumnsForTableId(TableId tableId) |
TypeRegistry |
getTypeRegistry() |
protected boolean |
isFilteredOut(TableId id) |
protected static TableId |
parse(String table) |
private void |
printReplicaIdentityInfo(PostgresConnection connection,
TableId tableId) |
protected PostgresSchema |
refresh(PostgresConnection connection,
boolean printReplicaIdentityInfo)
Initializes the content for this schema by reading all the database information from the supplied connection.
|
protected void |
refresh(PostgresConnection connection,
TableId tableId,
boolean refreshToastableColumns)
Refreshes this schema's content for a particular table
|
protected void |
refreshSchemas()
Discard any currently-cached schemas and rebuild them using the filters.
|
private void |
refreshToastableColumnsMap(PostgresConnection connection,
TableId tableId) |
Table |
tableFor(int relationId)
Resolve a
Table based on a supplied table relation unique identifier. |
boolean |
tableInformationComplete() |
assureNonEmptySchema, buildAndRegisterSchema, clearSchemas, close, getTableFilter, refresh, refreshSchema, removeSchema, schemaFor, tableFor, tableIds, tablesprotected static final String PUBLIC_SCHEMA_NAME
private static final org.slf4j.Logger LOGGER
private final TypeRegistry typeRegistry
private final boolean readToastableColumns
protected PostgresSchema(PostgresConnectorConfig config, TypeRegistry typeRegistry, Charset databaseCharset, TopicSelector<TableId> topicSelector)
Postgres connector configuration.config - the connector configuration, which is presumed to be validprivate static TableSchemaBuilder getTableSchemaBuilder(PostgresConnectorConfig config, TypeRegistry typeRegistry, Charset databaseCharset)
protected PostgresSchema refresh(PostgresConnection connection, boolean printReplicaIdentityInfo) throws SQLException
connection - a JdbcConnection instance, never nullprintReplicaIdentityInfo - whether or not to look and print out replica identity information about the tablesSQLException - if there is a problem obtaining the schema from the database serverprivate void printReplicaIdentityInfo(PostgresConnection connection, TableId tableId)
protected void refresh(PostgresConnection connection, TableId tableId, boolean refreshToastableColumns) throws SQLException
connection - a JdbcConnection instance, never nulltableId - the table identifier; may not be nullrefreshToastableColumns - refreshes the cache of toastable columns for `tableId`, if trueSQLException - if there is a problem refreshing the schema from the database serverprotected boolean isFilteredOut(TableId id)
protected void refreshSchemas()
private void refreshToastableColumnsMap(PostgresConnection connection, TableId tableId)
public TypeRegistry getTypeRegistry()
public void applySchemaChangesForTable(int relationId,
Table table)
relationId - the postgres relation unique identifier for the tabletable - externally constructed table, typically from the decoder; must not be nullpublic Table tableFor(int relationId)
Table based on a supplied table relation unique identifier.
This implementation relies on a prior call to applySchemaChangesForTable(int, Table) to have
applied schema changes from a replication stream with the relationId for the relationship to exist
and be capable of lookup.
relationId - the unique table relation identifierpublic boolean tableInformationComplete()
tableInformationComplete in interface DatabaseSchema<TableId>tableInformationComplete in class RelationalDatabaseSchemaCopyright © 2021 JBoss by Red Hat. All rights reserved.