Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move realDatabaseName out of the SqlServerConnection state #21

Closed
morozov opened this issue Mar 3, 2021 · 0 comments · Fixed by #25
Closed

Move realDatabaseName out of the SqlServerConnection state #21

morozov opened this issue Mar 3, 2021 · 0 comments · Fixed by #25
Assignees
Labels
SQL Server Debezium connector for SQL Server

Comments

@morozov
Copy link

morozov commented Mar 3, 2021

Currently, the "real" name of the source database is detected right after connecting to the database at the connection level:

public SqlServerConnection(Configuration config, Clock clock, SourceTimestampMode sourceTimestampMode, SqlServerValueConverters valueConverters,
Supplier<ClassLoader> classLoaderSupplier) {
super(config, FACTORY, classLoaderSupplier);
lsnToInstantCache = new BoundedConcurrentHashMap<>(100);
realDatabaseName = retrieveRealDatabaseName();

In order to make the connection reusable across multiple databases (#10), we need to:

  1. Detect the "real" name of all databases the task is working with.
  2. Make the real name available to all components that use it right now.

The most natural place for that seems to be the SqlServerTaskPartition and its Provider being introduced as part of #15.

Acceptance criteria:

  1. Add a dependency on SqlServerConnection to SqlServerPartitionTask.Provider.
  2. While initializing each task partition, execute a query like:
    SELECT name FROM sys.databases WHERE name = ?;
    It will return the database name in its actual case (e.g. mAsTeRmaster).
  3. If the query above doesn't return one and only one row, JDBC will throw an exception which the code should catch and log as a warning. No reason to fail the task.
  4. Initialize each SqlServerTaskPartition with a real database name instead of the configured one.
  5. Remove the current logic from the connection class.
@morozov morozov added the SQL Server Debezium connector for SQL Server label Mar 4, 2021
@morozov morozov changed the title Move conversion of dbname to realDatabaseName out of SqlServerConnection Move realDatabaseName out of the SqlServerConnection state Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SQL Server Debezium connector for SQL Server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants