@NotThreadSafe public final class SourceInfo extends BaseSourceInfo
The source partition information describes the database server for which we're streaming changes.
Typically, the server is identified by the host address port number and the name of the database. Here's a JSON-like
representation of an example database:
{
"server" : "production-server"
}
The source offset information describes a structure containing the position in the server's WAL for any
particular event, transaction id and the server timestamp at which the transaction that generated that particular event has
been committed. When performing snapshots, it may also contain a snapshot field which indicates that a particular record
is created while a snapshot it taking place.
Here's a JSON-like representation of an example:
{
"ts_usec": 1465937,
"lsn" : 99490,
"txId" : 123,
"snapshot": true
}
The "ts_usec" field contains the microseconds since Unix epoch (since Jan 1, 1970) representing the time at
which the transaction that generated the event was committed while the "txId" represents the server's unique transaction
identifier. The "lsn" field represent a numerical (long) value corresponding to the server's LSN for that particular
event and can be used to uniquely identify an event within the WAL.
The source struct appears in each message envelope and contains information about the event. It is
a mixture the fields from the partition and offset.
Like with the offset, the "snapshot" field only appears for events produced when the connector is in the
middle of a snapshot. Here's a JSON-like representation of the source for an event that corresponds to the above partition and
offset:
{
"name": "production-server",
"ts_usec": 1465937,
"lsn" : 99490,
"txId" : 123,
"snapshot": true
}
| Modifier and Type | Field and Description |
|---|---|
private String |
dbName |
static String |
LAST_SNAPSHOT_RECORD_KEY |
private Long |
lsn |
static String |
LSN_KEY |
private String |
schemaName |
private String |
tableName |
private Instant |
timestamp |
static String |
TIMESTAMP_USEC_KEY |
private Long |
txId |
static String |
TXID_KEY |
private Long |
xmin |
static String |
XMIN_KEY |
snapshotRecordCOLLECTION_NAME_KEY, DATABASE_NAME_KEY, DEBEZIUM_CONNECTOR_KEY, DEBEZIUM_VERSION_KEY, SCHEMA_NAME_KEY, SERVER_NAME_KEY, SNAPSHOT_KEY, TABLE_NAME_KEY, TIMESTAMP_KEY| Modifier | Constructor and Description |
|---|---|
protected |
SourceInfo(PostgresConnectorConfig connectorConfig) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
database() |
Long |
lsn() |
(package private) String |
schemaName() |
SnapshotRecord |
snapshot() |
(package private) String |
tableName() |
protected Instant |
timestamp() |
String |
toString() |
protected Long |
txId() |
protected SourceInfo |
update(Instant timestamp,
TableId tableId) |
protected SourceInfo |
update(Long lsn,
Instant commitTime,
Long txId,
TableId tableId,
Long xmin)
Updates the source with information about a particular received or read event.
|
Long |
xmin() |
isSnapshot, setSnapshotschema, serverName, struct, structMakerpublic static final String TIMESTAMP_USEC_KEY
public static final String TXID_KEY
public static final String XMIN_KEY
public static final String LSN_KEY
public static final String LAST_SNAPSHOT_RECORD_KEY
private final String dbName
private Long lsn
private Long txId
private Long xmin
private Instant timestamp
private String schemaName
private String tableName
protected SourceInfo(PostgresConnectorConfig connectorConfig)
protected SourceInfo update(Long lsn, Instant commitTime, Long txId, TableId tableId, Long xmin)
lsn - the position in the server WAL for a particular event; may be null indicating that this information is not
availablecommitTime - the commit time of the transaction that generated the event;
may be null indicating that this information is not availabletxId - the ID of the transaction that generated the transaction; may be null if this information is not availabletableId - the table that should be included in the source info; may be nullxmin - the xmin of the slot, may be nullprotected SourceInfo update(Instant timestamp, TableId tableId)
public Long lsn()
public Long xmin()
protected String database()
database in class AbstractSourceInfoString schemaName()
String tableName()
protected Instant timestamp()
timestamp in class AbstractSourceInfoprotected Long txId()
public SnapshotRecord snapshot()
snapshot in class BaseSourceInfoCopyright © 2019 JBoss by Red Hat. All rights reserved.