Package io.debezium.connector.sqlserver
Class SqlServerSnapshotChangeEventSource
- java.lang.Object
-
- io.debezium.pipeline.source.AbstractSnapshotChangeEventSource<P,O>
-
- io.debezium.relational.RelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>
-
- io.debezium.connector.sqlserver.SqlServerSnapshotChangeEventSource
-
- All Implemented Interfaces:
ChangeEventSource,SnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>
public class SqlServerSnapshotChangeEventSource extends RelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSqlServerSnapshotChangeEventSource.SqlServerSnapshotContextMutable context which is populated in the course of snapshotting.-
Nested classes/interfaces inherited from class io.debezium.relational.RelationalSnapshotChangeEventSource
RelationalSnapshotChangeEventSource.RelationalSnapshotContext<O extends OffsetContext>
-
Nested classes/interfaces inherited from class io.debezium.pipeline.source.AbstractSnapshotChangeEventSource
AbstractSnapshotChangeEventSource.SnapshotContext<O extends OffsetContext>, AbstractSnapshotChangeEventSource.SnapshottingTask
-
Nested classes/interfaces inherited from interface io.debezium.pipeline.source.spi.ChangeEventSource
ChangeEventSource.ChangeEventSourceContext
-
-
Field Summary
Fields Modifier and Type Field Description private Map<TableId,SqlServerChangeTable>changeTablesprivate SqlServerConnectorConfigconnectorConfigprivate SqlServerConnectionjdbcConnectionprivate static org.slf4j.LoggerLOGGERprivate SqlServerDatabaseSchemasqlServerDatabaseSchemaprivate static intTRANSACTION_SNAPSHOTCode 4096 corresponds to SNAPSHOT isolation level, which is not a part of the standard but SQL Server specific.-
Fields inherited from class io.debezium.relational.RelationalSnapshotChangeEventSource
clock, dispatcher, LOG_INTERVAL
-
-
Constructor Summary
Constructors Constructor Description SqlServerSnapshotChangeEventSource(SqlServerConnectorConfig connectorConfig, SqlServerConnection jdbcConnection, SqlServerDatabaseSchema schema, EventDispatcher<TableId> dispatcher, Clock clock, SnapshotProgressListener snapshotProgressListener)
-
Method Summary
-
Methods inherited from class io.debezium.relational.RelationalSnapshotChangeEventSource
createSchemaChangeEventsForTables, createSnapshotConnection, doExecute, getChangeRecordEmitter, getClock, getColumnValue, lastSnapshotRecord, postSnapshot, readTableStatement, releaseDataSnapshotLocks, rowCountForTable, schema, tryStartingSnapshot
-
Methods inherited from class io.debezium.pipeline.source.AbstractSnapshotChangeEventSource
delaySnapshotIfNeeded, determineDataCollectionsToBeSnapshotted, execute
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
TRANSACTION_SNAPSHOT
private static final int TRANSACTION_SNAPSHOT
Code 4096 corresponds to SNAPSHOT isolation level, which is not a part of the standard but SQL Server specific.- See Also:
- Constant Field Values
-
connectorConfig
private final SqlServerConnectorConfig connectorConfig
-
jdbcConnection
private final SqlServerConnection jdbcConnection
-
sqlServerDatabaseSchema
private final SqlServerDatabaseSchema sqlServerDatabaseSchema
-
changeTables
private Map<TableId,SqlServerChangeTable> changeTables
-
-
Constructor Detail
-
SqlServerSnapshotChangeEventSource
public SqlServerSnapshotChangeEventSource(SqlServerConnectorConfig connectorConfig, SqlServerConnection jdbcConnection, SqlServerDatabaseSchema schema, EventDispatcher<TableId> dispatcher, Clock clock, SnapshotProgressListener snapshotProgressListener)
-
-
Method Detail
-
getSnapshottingTask
protected AbstractSnapshotChangeEventSource.SnapshottingTask getSnapshottingTask(SqlServerOffsetContext previousOffset)
- Specified by:
getSnapshottingTaskin classAbstractSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>
-
prepare
protected AbstractSnapshotChangeEventSource.SnapshotContext<SqlServerOffsetContext> prepare(ChangeEventSource.ChangeEventSourceContext context) throws Exception
- Specified by:
preparein classAbstractSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>- Throws:
Exception
-
connectionCreated
protected void connectionCreated(RelationalSnapshotChangeEventSource.RelationalSnapshotContext<SqlServerOffsetContext> snapshotContext) throws Exception
- Overrides:
connectionCreatedin classRelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>- Throws:
Exception
-
getAllTableIds
protected Set<TableId> getAllTableIds(RelationalSnapshotChangeEventSource.RelationalSnapshotContext<SqlServerOffsetContext> ctx) throws Exception
- Specified by:
getAllTableIdsin classRelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>- Throws:
Exception
-
lockTablesForSchemaSnapshot
protected void lockTablesForSchemaSnapshot(ChangeEventSource.ChangeEventSourceContext sourceContext, RelationalSnapshotChangeEventSource.RelationalSnapshotContext<SqlServerOffsetContext> snapshotContext) throws SQLException, InterruptedException
- Specified by:
lockTablesForSchemaSnapshotin classRelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>- Throws:
SQLExceptionInterruptedException
-
releaseSchemaSnapshotLocks
protected void releaseSchemaSnapshotLocks(RelationalSnapshotChangeEventSource.RelationalSnapshotContext<SqlServerOffsetContext> snapshotContext) throws SQLException
- Specified by:
releaseSchemaSnapshotLocksin classRelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>- Throws:
SQLException
-
determineSnapshotOffset
protected void determineSnapshotOffset(RelationalSnapshotChangeEventSource.RelationalSnapshotContext<SqlServerOffsetContext> ctx, SqlServerOffsetContext previousOffset) throws Exception
- Specified by:
determineSnapshotOffsetin classRelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>- Throws:
Exception
-
readTableStructure
protected void readTableStructure(ChangeEventSource.ChangeEventSourceContext sourceContext, RelationalSnapshotChangeEventSource.RelationalSnapshotContext<SqlServerOffsetContext> snapshotContext, SqlServerOffsetContext offsetContext) throws SQLException, InterruptedException
- Specified by:
readTableStructurein classRelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>- Throws:
SQLExceptionInterruptedException
-
getCreateTableEvent
protected SchemaChangeEvent getCreateTableEvent(RelationalSnapshotChangeEventSource.RelationalSnapshotContext<SqlServerOffsetContext> snapshotContext, Table table) throws SQLException
- Specified by:
getCreateTableEventin classRelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>- Throws:
SQLException
-
complete
protected void complete(AbstractSnapshotChangeEventSource.SnapshotContext<SqlServerOffsetContext> snapshotContext)
- Overrides:
completein classAbstractSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>
-
getSnapshotSelect
protected Optional<String> getSnapshotSelect(RelationalSnapshotChangeEventSource.RelationalSnapshotContext<SqlServerOffsetContext> snapshotContext, TableId tableId)
Generate a valid sqlserver query string for the specified table- Specified by:
getSnapshotSelectin classRelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>- Parameters:
tableId- the table to generate a query for- Returns:
- a valid query string
-
enhanceOverriddenSelect
protected String enhanceOverriddenSelect(RelationalSnapshotChangeEventSource.RelationalSnapshotContext<SqlServerOffsetContext> snapshotContext, String overriddenSelect, TableId tableId)
- Overrides:
enhanceOverriddenSelectin classRelationalSnapshotChangeEventSource<SqlServerPartition,SqlServerOffsetContext>
-
-