Skip to content

Harden upsert compaction CRC mismatch handling - #19084

Open
Vamsi-klu wants to merge 1 commit into
apache:masterfrom
Vamsi-klu:fix/13491-upsert-compaction-crc-robustness
Open

Harden upsert compaction CRC mismatch handling#19084
Vamsi-klu wants to merge 1 commit into
apache:masterfrom
Vamsi-klu:fix/13491-upsert-compaction-crc-robustness

Conversation

@Vamsi-klu

Copy link
Copy Markdown
Contributor

Why

Upsert compaction must apply a server validDocIds bitmap only to a matching on-disk segment body. CRC mismatches across ZK / deepstore / replica servers caused tasks to skip work while looking healthy, or to fail opaquely on reload races. Ops could not tell “benign skip” from “hard failure,” and space reclaim stalled.

Much of the original “WARN then COMPLETED” path has hardened over time; this PR finishes observability, data-CRC alignment, and targeted retry without redesigning segment commit.

Impact

  • Clear skip vs fail signals (meters + progress messages) for ZK CRC change, empty valid docs, deepstore mismatch, server bitmap mismatch.
  • Fewer false failures when segment CRC differs but data CRC matches (crcMatches).
  • Better success rate on transient server reload races via bounded bitmap-fetch retry.
  • Safer ops: does not expand ignoreCrcMismatch defaults; still refuses to compact mismatched bytes+bitmap pairs.

How

  • Align deepstore Check B with MinionTaskUtils.crcMatches (segment CRC or data CRC).
  • Add minion meters for CRC skip/fail/empty-doc paths; surface skip reasons on progress observer.
  • Bounded retry on Check C server bitmap CRC mismatch before failing the task.
  • Unit coverage for executor convert/CRC branches (previously nearly untested).

Test plan

  • UpsertCompactionTaskExecutorTest — CRC match/mismatch, ignore flag, empty bitmap, null bitmap fail.
  • MinionTaskUtilsTest / BaseSingleSegmentConversionExecutorTest extensions for skip metering paths.
  • ./mvnw -pl pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks -am -Dtest=UpsertCompactionTaskExecutorTest,MinionTaskUtilsTest,BaseSingleSegmentConversionExecutorTest -Dsurefire.failIfNoSpecifiedTests=false test

Related

fixes: #13491

Reviewers

Suggested: tibrewalpratik17 (issue author)


Was generative AI tooling used to co-author this PR?
  • Yes — Grok Build (xAI)

Generated-by: Grok Build (xAI)

Compaction tasks could look successful while skipping work, or fail hard on
reload races and data-CRC-equivalent segments. Align checks with crcMatches,
meter skip/fail reasons, and retry transient server bitmap CRC mismatches.
@codecov-commenter

codecov-commenter commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.51948% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.51%. Comparing base (2bcbdfe) to head (26fbc42).

Files with missing lines Patch % Lines
...upsertcompaction/UpsertCompactionTaskExecutor.java 77.77% 11 Missing and 3 partials ⚠️
...ion/tasks/BaseSingleSegmentConversionExecutor.java 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19084      +/-   ##
============================================
+ Coverage     65.47%   65.51%   +0.04%     
- Complexity     1421     1438      +17     
============================================
  Files          3426     3426              
  Lines        217315   217378      +63     
  Branches      34509    34519      +10     
============================================
+ Hits         142283   142419     +136     
+ Misses        63513    63443      -70     
+ Partials      11519    11516       -3     
Flag Coverage Δ
custom-integration1 ?
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-25 65.51% <80.51%> (+0.04%) ⬆️
temurin 65.51% <80.51%> (+0.04%) ⬆️
unittests 65.51% <80.51%> (+0.04%) ⬆️
unittests1 56.85% <100.00%> (+0.02%) ⬆️
unittests2 37.91% <72.72%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Vamsi-klu

Copy link
Copy Markdown
Contributor Author

Ready for review — all required CI checks are green on this PR.

Issue: #13491

Could the following folks take a look when convenient?
@Jackie-Jiang
@tibrewalpratik17

Formal GitHub "Request review" is unavailable from a fork contributor account on apache/pinot (API returns 404/403), so this is the review ping.

Thank you!

@Jackie-Jiang Jackie-Jiang added enhancement Improvement to existing functionality upsert Related to upsert functionality observability Related to observability (logging, tracing, metrics) labels Jul 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Hardens upsert compaction task execution by aligning CRC validation across ZK/deepstore/server (including data-CRC fallback), improving observability for “skip vs fail” outcomes, and adding a bounded retry to mitigate transient server reload races during validDocIds bitmap fetch.

Changes:

  • Add deepstore CRC validation using the same segment/data CRC matching semantics as server-side matching, plus clearer skip/fail progress messages and meters.
  • Add bounded retry for validDocIds fetch on transient failures, with metering for terminal failure classification.
  • Expand unit coverage for new CRC match/mismatch branches, skip metering, and parsing/matching helpers.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/test/java/org/apache/pinot/plugin/minion/tasks/upsertcompaction/UpsertCompactionTaskExecutorTest.java Adds targeted unit tests for deepstore CRC validation, bitmap-fetch retry behavior, and skip metering.
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/test/java/org/apache/pinot/plugin/minion/tasks/MinionTaskUtilsTest.java Extends tests for new string CRC matching overload and parseCrc behavior.
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/test/java/org/apache/pinot/plugin/minion/tasks/BaseSingleSegmentConversionExecutorTest.java Adds coverage for ZK CRC-change skip path metering.
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/upsertcompaction/UpsertCompactionTaskExecutor.java Implements data-CRC-aware deepstore CRC validation, bounded bitmap-fetch retry, and clearer skip messaging + meters.
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/MinionTaskUtils.java Promotes CRC matching helper(s) to support deepstore/executor alignment; adds string overload + parseCrc utility.
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseSingleSegmentConversionExecutor.java Improves “ZK CRC changed” skip observability via progress message + meter.
pinot-common/src/main/java/org/apache/pinot/common/metrics/MinionMeter.java Adds new Minion meters for upsert-compaction CRC/skip/failure observability paths.

Comment on lines +177 to +178
RoaringBitmap bitmap = new RoaringBitmap();
bitmap.add(0, 1, 2);
Comment on lines +78 to +101

@BeforeMethod
public void setUp()
throws Exception {
_minionMetrics = mock(MinionMetrics.class);
// Force the process-global singleton so BaseTaskExecutor picks up the mock.
// register() only wins when current is NOOP; tests may run after other classes registered.
java.lang.reflect.Field field = MinionMetrics.class.getDeclaredField("MINION_METRICS_INSTANCE");
field.setAccessible(true);
@SuppressWarnings("unchecked")
java.util.concurrent.atomic.AtomicReference<MinionMetrics> ref =
(java.util.concurrent.atomic.AtomicReference<MinionMetrics>) field.get(null);
ref.set(_minionMetrics);

_eventObserver = MinionTaskTestUtils.getMinionProgressObserver();
_tempDir = new File(FileUtils.getTempDirectory(), "UpsertCompactionTaskExecutorTest-" + System.nanoTime());
Assert.assertTrue(_tempDir.mkdirs());
}

@AfterMethod
public void tearDown()
throws Exception {
FileUtils.deleteDirectory(_tempDir);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to existing functionality observability Related to observability (logging, tracing, metrics) upsert Related to upsert functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upsert Compaction Executor: CRC mismatch robustness

4 participants