Synthetic id upgrade test in serverless#142471
Conversation
Move TSDBSyntheticIdUpgradeIT to x-pack/plugin/logsdb/qa/rolling-upgrade This module is shadowed in serverless which means the test will also run in serverless environment. New parent class does not take care of upgrading the nodes, so this is added to TSDBSyntheticIdUpgradeIT, otherwise the test logic is unchanged.
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
There was a problem hiding this comment.
Pull request overview
Moves the TSDBSyntheticIdUpgradeIT rolling-upgrade coverage into the LogsDB rolling-upgrade QA module so it also runs in the serverless-shadowed variant, and adapts the test to perform node upgrades itself (since the new base class doesn’t parameterize upgrade phases).
Changes:
- Relocated/adapted
TSDBSyntheticIdUpgradeITto extendAbstractLogsdbRollingUpgradeTestCaseand run upgrades in-test viaupgradeNode(i). - Added
getClusterIndexVersion()helper toAbstractLogsdbRollingUpgradeTestCaseto determine the (uniform) cluster index version before upgrades.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/TSDBSyntheticIdUpgradeIT.java | Switches to LogsDB rolling-upgrade base class and rewrites test flow to perform rolling upgrades directly. |
| x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/AbstractLogsdbRollingUpgradeTestCase.java | Adds a helper to read/assert a uniform cluster IndexVersion from _nodes for pre-upgrade branching logic. |
Comments suppressed due to low confidence (2)
x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/TSDBSyntheticIdUpgradeIT.java:51
- Comment grammar: "Cluster support" should be "Cluster supports" (or rephrase) to read correctly.
x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/TSDBSyntheticIdUpgradeIT.java:35 - Avoid referencing the inherited static field
clusterdirectly; prefergetCluster()(or qualify withAbstractLogsdbRollingUpgradeTestCase.cluster) so the access is explicit and future overrides/test harness changes are easier.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| public void testRollingUpgrade() throws IOException { | ||
| IndexVersion oldClusterIndexVersion = getOldClusterIndexVersion(); | ||
| IndexVersion oldClusterIndexVersion = getClusterIndexVersion(); |
There was a problem hiding this comment.
Is there a test node feature for synthetic id? Some other bwc intregation tests do:
assumeTrue("...", oldClusterHasFeature(MY_CONSTANT));
If there isn't a node feature, then I think you can use something like: gte_v9.4.0? But maybe it is better to use a node feature, this makes not running integration tests in other contexts easier.
There was a problem hiding this comment.
I've added a test node feature in this commit ba04200
There was a problem hiding this comment.
Adding the node feature and relying on for this branch makes the test fail when run against main (9.4.0-snapshot) because main doesn't have the node feature but has support for synthetic id so test expect an exception but cluster happily create index.
I will add the node feature in a different branch and then update this test once the node feature has been merged to avoid this in between state.
There was a problem hiding this comment.
👍 , so when that is merged, then this test can just do:
assumeTrue("old cluster needs to support synthetic id", oldClusterHasFeature(IndexFeatures.TIME_SERIES_SYNTHETIC_ID));and then there should be no need to check index version and the getClusterIndexVersion() helper method.
There was a problem hiding this comment.
The most important part of this test is to verify the behavior when upgrading from a version without to a version with the feature and make sure we fail in a way that is expected (fail to create index with reasonable exception message). So assumeTrue would be counter productive 😌
The only thing the version is used for otherwise is the exception message verification but maybe that's not a good enough reason to introduce the getClusterIndexVersion? I'll see what I can do to remove it 👍
Add IndexFeatures.TIME_SERIES_SYNTHETIC_ID and use it in TSDBSyntheticIdUpgradeIT instead of checking index version, so BWC tests can use oldClusterHasFeature() like other rolling upgrade tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This reverts commit ba04200.
…exVersion - Branch test on oldClusterHasFeature(IndexFeatures.TIME_SERIES_SYNTHETIC_ID) - Relax assertNoWriteIndex: verify illegal_argument_exception and setting rejection message without depending on index version text - Remove getClusterIndexVersion and getOldClusterVersion from base class Co-authored-by: Cursor <cursoragent@cursor.com>
…tatus randomLongBetween(0, 1000) can yield 0, which triggers the assertion in IndexShardSnapshotStatus.moveToDone that startTimeMillis != 0. Use randomLongBetween(1, 1000) so the test satisfies the invariant. Co-authored-by: Cursor <cursoragent@cursor.com>
fcofdez
left a comment
There was a problem hiding this comment.
LGTM. I left a minor comment.
| switch (stage) { | ||
| case DONE -> { | ||
| final long startTimeMillis = randomLongBetween(0, 1000); | ||
| final long startTimeMillis = randomLongBetween(1, 1000); |
There was a problem hiding this comment.
Yes, this fixes a test failure. From commit message (beautifully composed by Cursor):
randomLongBetween(0, 1000) can yield 0, which triggers the assertion
in IndexShardSnapshotStatus.moveToDone that startTimeMillis != 0.
Use randomLongBetween(1, 1000) so the test satisfies the invariant.
There was a problem hiding this comment.
Maybe we can move this into its own commit/PR?
| assertIndexRead("second-mixed-cluster-index"); | ||
| int numNodes = getCluster().getNumNodes(); | ||
|
|
||
| if (oldClusterHasFeature(IndexFeatures.TIME_SERIES_SYNTHETIC_ID)) { |
There was a problem hiding this comment.
The feature only guards the test execution?
There was a problem hiding this comment.
Yes, it's a substitute for checking index version directly used by other tsdb tests and suggested by @martijnvg . The node feature was introduced in #142581 and only exist in 9.4 and later which makes it work the same way as checking index version directly. Maybe Martijn can elaborate on why this is preferred?
There was a problem hiding this comment.
I think index versions can also be used, but cluster features are a more straight forward way to determine whether a cluster supports a specific feature? No need to introduce logic to extract index versions and the cluster feature testing infrastructure (e.g. oldClusterHasFeature(...)) can just be reused.
There was a problem hiding this comment.
Thanks for clarifying Martijn!
…r DONE status" This reverts commit e751794.
…etic-id-rolling-upgrade-in-serverless
|
Waiting for #142581 to be promoted to production until merging this. |
…etic-id-rolling-upgrade-in-serverless
|
can't we merge this @burqen? |
I triggered a new build so check, but I don't think it has been promoted yet. EDIT: Still waiting for promotion |
…etic-id-rolling-upgrade-in-serverless
…etic-id-rolling-upgrade-in-serverless
And also adapt to use clusterRollingUpgrade instead of calling upgradeNode directly.
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Move TSDBSyntheticIdUpgradeIT to x-pack/plugin/logsdb/qa/rolling-upgrade This module is shadowed in serverless which means the test will also test rolling upgrade in serverless. * Use TIME_SERIES_SYNTHETIC_ID node feature in upgrade test, remove IndexVersion * Avoid analyse disk size in serverless, because that api is not available * Add logging to track failure * Add writing to all existing indices throughout the rolling upgrade --------- Co-authored-by: Cursor <cursoragent@cursor.com>
…locations * upstream/main: (153 commits) ES|QL: Update docs for TOP_SNIPPETS and DECAY (elastic#143739) Correctly include endpoint id in log msg in AuthorizationPoller (elastic#143743) Bar searching or sorting on _seq_no when disabled (elastic#143600) Generalize `testClientCancellation` test (elastic#143586) JSON_EXTRACT: zero-copy byte slicing for object, array, and number extraction (elastic#143702) Track recycler pages in circuit breaker (elastic#143738) [ESQL] Enable distributed pipeline breakers for external sources via FragmentExec (elastic#143696) Adding 'mode' and 'codec' fields to ES monitoring template (elastic#143673) [ESQL] Columnar I/O and vectorized block conversion for external sources (elastic#143703) Fix flaky MMR diversification YAML tests (elastic#143706) ES|QL codegen: check builder arguments for vector support (elastic#143724) Add Views Security Model (elastic#141050) ESQL: Prevent pushdown of unmapped fields in filters and sorts (elastic#143460) Don't run seq_no pruning tests in release CI (elastic#143725) ESQL: Support intra-row field references in ROW command (elastic#140217) ES|QL: Remove implicit limit in FORK branches in CSV tests (elastic#143601) IndexRoutingTests with and without synthetic id (elastic#143566) Synthetic id upgrade test in serverless (elastic#142471) Disable "Review skipped" comments for PRs without specified labels (elastic#143728) Cleanup ES|QL T-Digest code duplication, add memory accounting (elastic#143662) ...
Move TSDBSyntheticIdUpgradeIT to x-pack/plugin/logsdb/qa/rolling-upgrade This module is shadowed in serverless which means the test will also test rolling upgrade in serverless. * Use TIME_SERIES_SYNTHETIC_ID node feature in upgrade test, remove IndexVersion * Avoid analyse disk size in serverless, because that api is not available * Add logging to track failure * Add writing to all existing indices throughout the rolling upgrade --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Move
TSDBSyntheticIdUpgradeITtox-pack/plugin/logsdb/qa/rolling-upgrade. This module is shadowed in serverless which means the test will also run in serverless environment.New parent class does not take care of upgrading the nodes, so this is added to TSDBSyntheticIdUpgradeIT, otherwise the test logic is unchanged.
Relates ES-14000
Continuation of #141525