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

Gate reading of optional string array for bwc #106878

Merged
merged 20 commits into from Mar 29, 2024

Conversation

salvatore-campagna
Copy link
Contributor

@salvatore-campagna salvatore-campagna commented Mar 28, 2024

Missing a check on the transport version results in unreadable cluster state
if it includes a serialized instance of DownsampleShardTaskParams.
#98023 introduced an optional string array including dimensions used by time
serie indices.
Reading an optional array requires reading a boolean first which is required to
know if an array of values exists in serialized form. From 8.13 on we try to
read such a boolean which is not there because older versions don't write any
boolean nor any string array. Here we include the check on versions for backward
compatibility skipping reading any boolean or array whatsoever whenever not possible.

Customers using downsampling might have cluster states including such serielized
objects and would be unable to upgrade to version 8.13. They will be able to
upgrade to any version including this fix.

This fix has a side effect #106880

@salvatore-campagna salvatore-campagna added :StorageEngine/Downsampling Downsampling (replacement for rollups) - Turn fine-grained time-based data into coarser-grained data v8.13.1 labels Mar 28, 2024
@salvatore-campagna salvatore-campagna self-assigned this Mar 28, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@salvatore-campagna
Copy link
Contributor Author

Note that this issue as a side effect described here #106880

@elasticsearchmachine
Copy link
Collaborator

Hi @salvatore-campagna, I've created a changelog YAML for you.

@salvatore-campagna salvatore-campagna requested a review from a team as a code owner March 28, 2024 18:23
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one question otherwise LGTM

@dnhatn dnhatn requested a review from mark-vieira March 28, 2024 23:42
@dnhatn dnhatn added the auto-backport-and-merge Automatically create backport pull requests and merge when ready label Mar 29, 2024
@dnhatn dnhatn merged commit f7fedb4 into elastic:main Mar 29, 2024
12 of 14 checks passed
dnhatn pushed a commit to dnhatn/elasticsearch that referenced this pull request Mar 29, 2024
Missing a check on the transport version results in unreadable cluster state
if it includes a serialized instance of DownsampleShardTaskParams.
serie indices.
Reading an optional array requires reading a boolean first which is required to
know if an array of values exists in serialized form. From 8.13 on we try to
read such a boolean which is not there because older versions don't write any
boolean nor any string array. Here we include the check on versions for backward
compatibility skipping reading any boolean or array whatsoever whenever not possible.

Customers using downsampling might have cluster states including such serielized
objects and would be unable to upgrade to version 8.13. They will be able to
upgrade to any version including this fix.

This fix has a side effect elastic#106880
@elastic elastic deleted a comment from elasticsearchmachine Mar 29, 2024
elasticsearchmachine pushed a commit that referenced this pull request Mar 29, 2024
…06896)

Missing a check on the transport version results in unreadable cluster state
if it includes a serialized instance of DownsampleShardTaskParams.
serie indices.
Reading an optional array requires reading a boolean first which is required to
know if an array of values exists in serialized form. From 8.13 on we try to
read such a boolean which is not there because older versions don't write any
boolean nor any string array. Here we include the check on versions for backward
compatibility skipping reading any boolean or array whatsoever whenever not possible.

Customers using downsampling might have cluster states including such serielized
objects and would be unable to upgrade to version 8.13. They will be able to
upgrade to any version including this fix.

This fix has a side effect #106880

Co-authored-by: Salvatore Campagna <93581129+salvatore-campagna@users.noreply.github.com>
@dnhatn
Copy link
Member

dnhatn commented Mar 29, 2024

Backported to 8.13 in #106896

@@ -564,6 +564,15 @@ public XContentBuilder buildDownsampleDocument() throws IOException {
fieldProducer.write(builder);
}

if (dimensions.length == 0) {
logger.debug("extracting dimensions from legacy tsid");
Copy link
Contributor

@kkrik-es kkrik-es Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are two dimensions here:

  • Older index, using legacy tsid. This is controlled by IndexVersion.
  • Older transport layer, passing no dimensions. This is controlled by TransportVersion.

It seems possible to have a mix of older indexes with newer transport, as well as newer indexes with older transport. If so, can this fail in case we use a newer index (created in 8.13) with an updated tsid, through an older persistent task? @salvatore-campagna thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport-and-merge Automatically create backport pull requests and merge when ready backport pending >bug :StorageEngine/Downsampling Downsampling (replacement for rollups) - Turn fine-grained time-based data into coarser-grained data Team:StorageEngine v8.13.1 v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants