Repository navigation
[improve][io] ElasticSearch sink: conditional id hashing - #18668
Merged
nicoloboschi merged 3 commits intoNov 30, 2022
Merged
Conversation
nicoloboschi
requested review from
eolivelli and
urfreespace
and removed request for
eolivelli
November 29, 2022 09:23
eolivelli
requested changes
Nov 29, 2022
Member
|
@nicoloboschi @eolivelli I'm just wondering if the behavior of For example in the test, the |
lifepuzzlefun
pushed a commit
to lifepuzzlefun/pulsar
that referenced
this pull request
Dec 9, 2022
lifepuzzlefun
pushed a commit
to lifepuzzlefun/pulsar
that referenced
this pull request
Jan 10, 2023
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
#15428 introduced a new flag for hashing the document id. This is a great option for not getting into the hard limit of 512 bytes of ElasticSearch.
In prod environment this flag is likely to not be enabled without troubles. If the sink was working before without that flag, all the doc ids are formatted as JSON format. With the same key, an update or deletion would be triggered on ES side. If the user enables the hashing option, those ids won't matching anymore and it will end up creating new records.
In some cases this is not a viable option. Since the hashing algo is actually useful only for workaround the ES limit, it makes sense to have an option to only hash if the would be key length errors on ES side.
In this way, in a living cluster the hashing could be turned on with 100% compatibility with the existing documents.
The collision between an hashed key and a non hashed key is not possible:
To sum up, if a living env hits the issue, these are the suggested steps to get the sink to work again without losing messages and unblocking the subscription:
canonicalKeyFields=trueidHashingAlgorithm=SHA256conditionalIdHashing=trueNote that changing may alter the key format and therefore creates new records but it's required to get the hashing option to works correctly.
Modifications
conditionalIdHashingdefault to false. If the raw key is <= 512 bytes and idHashingAlgorithm is set, then the hashing won't be performedDocumentation
docdoc-requireddoc-not-neededdoc-complete