-
Notifications
You must be signed in to change notification settings - Fork 23
oplogPopulator: route oplog key through TransformObjectKey SMT when available #2741
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
Closed
delthas
wants to merge
1
commit into
development/9.5
from
improvement/BB-768/oplog-partition-by-object-key
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ const paramsJoi = joi.object({ | |
| cronRule: joi.string().required(), | ||
| prefix: joi.string(), | ||
| heartbeatIntervalMs: joi.number().required(), | ||
| transformObjectKey: joi.boolean().default(false), | ||
| kafkaConnectHost: joi.string().required(), | ||
| kafkaConnectPort: joi.number().required(), | ||
| metricsHandler: joi.object() | ||
|
|
@@ -81,6 +82,11 @@ class ConnectorsManager extends EventEmitter { | |
| this._oldConnectors = []; | ||
| this._allocationStrategy = params.allocationStrategy; | ||
| this._pipelineFactory = params.pipelineFactory; | ||
| // When true, connectors are configured with the TransformObjectKey | ||
| // SMT so the oplog message key is the raw S3 object key. Enabled via | ||
| // the oplogPopulator 'transformObjectKey' config flag, set by the | ||
| // operator once Kafka Connect ships the TransformObjectKey plugin. | ||
| this._transformObjectKey = params.transformObjectKey || false; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. defaulting is not needed here, already handling by |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -102,6 +108,7 @@ class ConnectorsManager extends EventEmitter { | |
| }; | ||
| return { | ||
| ...constants.defaultConnectorConfig, | ||
| ...(this._transformObjectKey ? constants.smtKeyConfig : {}), | ||
| ...connectorConfig | ||
|
delthas marked this conversation as resolved.
|
||
| }; | ||
| } | ||
|
|
@@ -165,12 +172,26 @@ class ConnectorsManager extends EventEmitter { | |
| } | ||
| // generating a new config as the old config can be outdated (wrong topic for example) | ||
| const config = this._getDefaultConnectorConfiguration(connectorName); | ||
| // update existing connector config while leaving in fields that were | ||
| // added manually like 'offset.topic.name' | ||
| const mergedConfig = { ...oldConfig, ...config }; | ||
| // When the SMT is disabled, scrub any SMT-only keys that may | ||
| // linger in oldConfig from a previous run with it enabled. | ||
| // Otherwise the connector keeps referencing the missing | ||
| // TransformObjectKey class and fails to start. The SMT-only | ||
| // keys are those in smtKeyConfig that the legacy base does not | ||
| // also define (output.schema.key is restored, not removed). | ||
| if (!this._transformObjectKey) { | ||
| for (const k of Object.keys(constants.smtKeyConfig)) { | ||
| if (!(k in constants.defaultConnectorConfig)) { | ||
| delete mergedConfig[k]; | ||
| } | ||
| } | ||
| } | ||
| // initializing connector | ||
| const connector = new Connector({ | ||
| name: connectorName, | ||
| // update existing connector config while leaving in fields that were | ||
| // added manually like 'offset.topic.name' | ||
| config: { ...oldConfig, ...config }, | ||
| config: mergedConfig, | ||
| buckets, | ||
| getPipeline: this._pipelineFactory.getPipeline, | ||
| isRunning: true, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.f. https://scality.atlassian.net/browse/BB-768?focusedCommentId=477005 :
update, so the key should be available (but maybe not in "fullDocument")deleteevent is not used AFAIK (we generate an update with the previous document right before it), and may be dropped instead→ is there a simpler (as in "less maitenance") fix?