Skip to content

Conversation

Kubik42
Copy link
Contributor

@Kubik42 Kubik42 commented Aug 28, 2025

This is a follow up for #133493 and #133562.

This resolves #133543.

There a series of problems with this test case, namely:

  • it doesn't use a cluster with OLD_CLUSTER_VERSION, meaning the cluster upgrade just upgrades from newest version to newest version
  • it doesn't correctly configure the cluster to be used during the upgrade (missing getUpgradeCluster()), meaning we upgrade the base cluster, defined in the parent class, instead of the correct one
  • it performs a rollover immediately after upgrading a single nodes and immediately after upgrading all nodes - this makes it impossible to catch issues with the upgraded write index since it gets replaced by a new one

This PR addresses all of these problems + refactors the class to be cleaner and more readable.

Note, even if this test were setup correctly, it would not have caught the norms bwc bug. This is because that bug is triggered on existing logsdb indices during upgrade. In this case however, we only enable logsdb once the upgrade is completed. There is already a test that verifies this, its LogsdbIndexingRollingUpgradeIT.

To verify that the changes in this PR are effective, I enabled logsdb early and reverted my change in #133493. The result is the following error, as expected:

LogsIndexModeRollingUpgradeIT > testLogsIndexing {upgradedNodes=3} FAILED
    java.lang.AssertionError: errors in response:
     {took=205, items=[{create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTh, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTi, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTj, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTk, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTl, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTm, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTn, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTo, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTp, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTq, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTr, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}, {create={_index=.ds-logs-apache-production-2025.08.28-000001, failure_store=not_enabled, _id=AZjy4-P3wFxl9GupgoTs, error={reason=cannot change field "message" from omitNorms=false to inconsistent omitNorms=true, type=illegal_argument_exception}, status=400}}], errors=true}
    Expected: is <false>
         but: was <true>
        at __randomizedtesting.SeedInfo.seed([9AC1444837164B09:A77BFF1C68A802D7]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.elasticsearch.test.ESTestCase.assertThat(ESTestCase.java:2710)
        at org.elasticsearch.upgrades.LogsIndexModeRollingUpgradeIT.bulkIndex(LogsIndexModeRollingUpgradeIT.java:197)
        at org.elasticsearch.upgrades.LogsIndexModeRollingUpgradeIT.testLogsIndexing(LogsIndexModeRollingUpgradeIT.java:132)

@Kubik42 Kubik42 added >test Issues or PRs that are addressing/adding tests Team:StorageEngine :StorageEngine/Mapping The storage related side of mappings labels Aug 28, 2025
@elasticsearchmachine
Copy link
Collaborator

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


// then continued - verify that only the latest write index has logsdb enabled
assertIndexSettings(0, Matchers.nullValue());
assertIndexSettings(1, Matchers.nullValue());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since we no longer rollover when the cluster is in a mixed state, we have only two indices at the end


// then - ensure no issues
assertOK(response);
assertThat("errors in response:\n " + responseBody, responseBody.get("errors"), Matchers.is(false));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

printing the error in response here makes finding the errors significantly easier. Previously, I had to log dive to understand what happened

/**
* This test starts with LogsDB disabled, performs an upgrade, enables LogsDB and indexes some documents.
*/
public class LogsIndexModeRollingUpgradeIT extends AbstractRollingUpgradeWithSecurityTestCase {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Swapped AbstractRollingUpgradeTestCase for AbstractRollingUpgradeWithSecurityTestCase since this test has auth enabled.

@Kubik42 Kubik42 force-pushed the 133543-bwc-test-coverage-for-norms branch from 947b5f6 to 337ddc9 Compare August 29, 2025 00:16
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.

LGTM 👍

@Kubik42 Kubik42 merged commit 8b88cc3 into elastic:main Aug 29, 2025
33 checks passed
Kubik42 added a commit to Kubik42/elasticsearch that referenced this pull request Sep 11, 2025
* Fixed LogsIndexModeRollingUpgradeIT

* Renamed test class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:StorageEngine/Mapping The storage related side of mappings Team:StorageEngine >test Issues or PRs that are addressing/adding tests v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change LogsIndexModeRollingUpgradeIT

3 participants