DBZ-3557 Remove exclusive
from SnapshotLockingMode, use shared
as default
This commit is contained in:
parent
d9d2706a17
commit
078b8f7270
@ -93,16 +93,15 @@ public class OracleConnectorConfig extends HistorizedRelationalDatabaseConnector
|
||||
|
||||
public static final Field SNAPSHOT_LOCKING_MODE = Field.create("snapshot.locking.mode")
|
||||
.withDisplayName("Snapshot locking mode")
|
||||
.withEnum(SnapshotLockingMode.class, SnapshotLockingMode.EXCLUSIVE)
|
||||
.withEnum(SnapshotLockingMode.class, SnapshotLockingMode.SHARED)
|
||||
.withWidth(Width.SHORT)
|
||||
.withImportance(Importance.LOW)
|
||||
.withDescription("Controls how the connector holds locks on tables while performing the schema snapshot. The default is 'exclusive', "
|
||||
+ "which means the connector will hold an exclusive table lock (prevents any updates) for just the initial portion of the snapshot "
|
||||
.withDescription("Controls how the connector holds locks on tables while performing the schema snapshot. The default is 'shared', "
|
||||
+ "which means the connector will hold a table lock that prevents exclusive table access for just the initial portion of the snapshot "
|
||||
+ "while the database schemas and other metadata are being read. The remaining work in a snapshot involves selecting all rows from "
|
||||
+ "each table, and this is done using a flashback query that requires no locks. However, in some cases it may be desirable to allow "
|
||||
+ "concurrent access to the table but prevent locking the entire table; in such cases set this property to 'shared'. Using a value of "
|
||||
+ "'none' will prevent the connector from acquiring any locks during the snapshot process. This mode is only safe to use if no schema "
|
||||
+ "changes are happening while the snapshot is taken.");
|
||||
+ "each table, and this is done using a flashback query that requires no locks. However, in some cases it may be desirable to avoid "
|
||||
+ "locks entirely which can be done by specifying 'none'. This mode is only safe to use if no schema changes are happening while the "
|
||||
+ "snapshot is taken.");
|
||||
|
||||
public static final Field ORACLE_VERSION = Field.createInternal("database.oracle.version")
|
||||
.withDisplayName("Oracle version, 11 or 12+")
|
||||
@ -532,12 +531,6 @@ public static SnapshotMode parse(String value, String defaultValue) {
|
||||
}
|
||||
|
||||
public enum SnapshotLockingMode implements EnumeratedValue {
|
||||
/**
|
||||
* This mode will block all updates and writes for the duration of lock.
|
||||
* This is the default mode.
|
||||
*/
|
||||
EXCLUSIVE("exclusive"),
|
||||
|
||||
/**
|
||||
* This mode will allow concurrent access to the table during the snapshot but prevents any
|
||||
* session from acquiring any table-level exclusive lock.
|
||||
@ -561,10 +554,6 @@ public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean usesExclusiveLocking() {
|
||||
return value.equals(EXCLUSIVE.value);
|
||||
}
|
||||
|
||||
public boolean usesLocking() {
|
||||
return !value.equals(NONE.value);
|
||||
}
|
||||
|
@ -96,12 +96,7 @@ protected void lockTablesForSchemaSnapshot(ChangeEventSourceContext sourceContex
|
||||
}
|
||||
|
||||
LOGGER.debug("Locking table {}", tableId);
|
||||
if (connectorConfig.getSnapshotLockingMode().usesExclusiveLocking()) {
|
||||
statement.execute("LOCK TABLE " + quote(tableId) + " IN EXCLUSIVE MODE");
|
||||
}
|
||||
else {
|
||||
statement.execute("LOCK TABLE " + quote(tableId) + " IN SHARE UPDATE MODE");
|
||||
}
|
||||
statement.execute("LOCK TABLE " + quote(tableId) + " IN ROW SHARE MODE");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ the default behavior for performing a snapshot consists of the following steps.
|
||||
you can change this behavior by setting the `snapshot.mode` connector configuration property to a value other than `initial`.
|
||||
|
||||
1. Determine the tables to be captured
|
||||
2. Obtain an `IN EXCLUSIVE MODE` lock on each of the monitored tables to ensure that no structural changes can occur to any of the tables.
|
||||
2. Obtain an `ROW SHARE MODE` lock on each of the monitored tables to ensure that no structural changes can occur to any of the tables.
|
||||
3. Read the current SCN ("system change number") position in the server's redo log.
|
||||
4. Capture the structure of all relevant tables.
|
||||
5. Release the locks obtained in step 2, i.e. the locks are held only for a short period of time.
|
||||
@ -1302,12 +1302,10 @@ Skipping should be used only with care as it can lead to data loss or mangling w
|
||||
|A mode for taking an initial snapshot of the structure and optionally data of captured tables. Supported values are _initial_ (will take a snapshot of structure and data of captured tables; useful if topics should be populated with a complete representation of the data from the captured tables) and _schema_only_ (will take a snapshot of the structure of captured tables only; useful if only changes happening from now onwards should be propagated to topics). Once the snapshot is complete, the connector will continue reading change events from the database's redo logs.
|
||||
|
||||
|[[oracle-property-snapshot-locking-mode]]<<oracle-property-snapshot-locking-mode, `+snapshot.locking.mode+`>>
|
||||
|_exclusive_
|
||||
a|Controls whether and how long the connector holds a table lock, which prevents any updates to the database, while the connector is performing a snapshot. Possible settings are: +
|
||||
|_shared_
|
||||
a|Controls whether and how long the connector holds a table lock, which prevents certain types of changes table operations, while the connector is performing a snapshot. Possible settings are: +
|
||||
+
|
||||
`exclusive` - the connector holds an exclusive table lock for the initial portion of the snapshot during which the connector reads the database schemas and other metadata. The remaining work in a snapshot involves selecting all rows from each table using flashback queries. +
|
||||
+
|
||||
`shared` - allows concurrent access to the table but prevents any session from acquring a table exclusive lock. +
|
||||
`shared` - allows concurrent access to the table but prevents any session from acquiring a table exclusive lock. +
|
||||
+
|
||||
`none` - prevents the connector from acquiring any table locks during the snapshot. This setting is only safe to use if and _only_ if no schema changes are happening while the snapshot is running.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user