branch-4.1: [fix](inverted index) Persist empty index files and stop writing orphan ones #67859 - #68082
Open
airborne12 wants to merge 1 commit into
Open
branch-4.1: [fix](inverted index) Persist empty index files and stop writing orphan ones #67859#68082airborne12 wants to merge 1 commit into
airborne12 wants to merge 1 commit into
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Member
Author
|
run cloud_ut |
…writing orphan ones apache#67859 ### What problem does this PR solve? Issue Number: N/A Related PR: apache#67859 Problem Summary: An all-NULL VARIANT column can legitimately produce a zero-byte V2/V3 index container. Close empty containers through the FileWriter interface so local, HDFS, stream, S3, packed, and future implementations all persist the same state. Let IndexBuilder treat an empty source container like a missing one, and do not write an orphan container when the output rowset schema owns no inverted or ANN index. This branch does not contain SNII, so the source PR's SNII dispatch and test are not applicable. The V2/V3 behavior is preserved using the branch-4.1 TabletSchema predicates and APIs. Validation: - BUILD_TYPE=ASAN ./build.sh --be -j32 - ./build.sh --fe -j16 - Focused ASAN BE unit tests: 25 passed, 0 failed - test_empty_index_file_lifecycle: passed - test_variant_empty_index_file: passed - clang-format 16 and git diff --check: passed - Targeted changed-line clang-tidy checks: passed ### Release note Persist legitimate empty V2/V3 inverted-index files, allow index rebuilds to consume them, and avoid orphan index files after the last index is gone. ### Check List (For Author) - Test - [x] Regression test - [x] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason - Behavior changed: - [ ] No. - [x] Yes. Empty index containers are persisted, accepted by IndexBuilder, and omitted when the output schema owns no index. - Does this need documentation? - [x] No. This restores the existing rowset/index-file invariant. - [ ] Yes. (cherry picked from commit 8d9e9c3) Conflicts: - Adapted TabletSchema index predicates and block construction to branch-4.1. - Omitted SNII-only code and coverage because branch-4.1 has no SNII format. - Preserved branch-specific VARIANT debug-point expectations and disabled the branch-4.1 file cache inside the isolated S3 unit test.
yiguolei
force-pushed
the
pick-67859-branch-4.1
branch
from
September 19, 2026 07:43
a783b54 to
ed58d29
Compare
Contributor
|
run buildall |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
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.
What problem does this PR solve?
Issue Number: N/A
Related PR: #67859
Problem Summary:
This backports source commit
8d9e9c3f6d0ff2186a6ac52bb572a6fbee457938tobranch-4.1.An all-NULL VARIANT column can legitimately produce a zero-byte V2/V3 index container. The old empty-file path closed only selected writer implementations, so a local writer could abort and delete the file during destruction.
IndexBuilderalso rejected an empty source container and could write an orphan container after the output schema lost its last index.The backport:
FileWriterinterface while preserving the two-phase close protocol and error propagation.branch-4.1has no SNII format, so the source PR's SNII dispatch and SNII-only unit test are not applicable. The V2/V3 behavior uses this branch's splithas_inverted_index()/has_ann_index()predicates and older block APIs.Release note
Persist legitimate empty V2/V3 inverted-index files, allow index rebuilds to consume them, and avoid orphan index files after the last index is gone.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Validation
BUILD_TYPE=ASAN ./build.sh --be -j32: passed../build.sh --fe -j16: passed, including Checkstyle.EmptyIndexFileTestcases, fiveIndexBuilderTestcases, the null-array VARIANT case, and the S3 empty-file case: 25/25 passed twice, with no sanitizer report.test_empty_index_file_lifecycle: passed 1/1 on an isolated classic cluster.test_variant_empty_index_file: passed 1/1 on the same cluster.NOLINTENDinbe/src/core/types.hand legacy whole-function diagnostics in branch-4.1; no new changed-line diagnostic remains.Backport audit
git range-diff 8d9e9c3^! origin/branch-4.1...HEADwas reviewed. Positional differences come from the older branch layout and APIs. The two regression-test file patches have stable patch IDs identical to the source. Every source hunk is accounted for below.be/src/storage/index/index_file_writer.cpp@@ -30 +29,0 @@@@ -511,4 +510,10 @@ Status IndexFileWriter::begin_close()FileWriter; the branch has no preceding SNII path.@@ -559,4 +564,5 @@ Status IndexFileWriter::finish_close()be/src/storage/task/index_builder.cpp@@ -389 +389,8 @@ Status IndexBuilder::update_inverted_index_info()INVERTED_INDEX_BYPASSexactly like missing input; comments use branch terminology.@@ -449,2 +456,17 @@ Status IndexBuilder::handle_single_rowset(RowsetMetaSharedPtr output_rowset_meta@@ -519 +540,0 @@ Status IndexBuilder::handle_single_rowset(RowsetMetaSharedPtr output_rowset_meta@@ -520,0 +542,12 @@ Status IndexBuilder::handle_single_rowset(RowsetMetaSharedPtr output_rowset_meta@@ -524,0 +558,3 @@ Status IndexBuilder::handle_single_rowset(RowsetMetaSharedPtr output_rowset_metafs()only for the V2/V3 path that will write a file; there is no SNII dispatch here.be/test/io/fs/s3_file_writer_test.cpp@@ -1533 +1533 @@ TEST_F(S3FileWriterTest, test_empty_file)enable_file_cache=falsebecause the branch-4.1 fixture otherwise reaches an uninitialized cache factory.@@ -1537,0 +1538,2 @@ TEST_F(S3FileWriterTest, test_empty_file)@@ -1545,2 +1547,14 @@ TEST_F(S3FileWriterTest, test_empty_file)be/test/storage/index/index_builder_test.cpp@@ -23,0 +24 @@@@ -536,0 +538,123 @@ protected:create_block()and scoped column mutation; preserve empty-vs-missing source coverage. Specific complexity suppressions document the assertion-heavy test helper.@@ -709 +833,3 @@ TEST_F(IndexBuilderTest, DropInvertedIndexTest).idxfile.@@ -1027,0 +1154,20 @@ TEST_F(IndexBuilderTest, BuildInvertedIndexAfterWritingDataTest)@@ -3509,0 +3656,22 @@ TEST_F(IndexBuilderTest, DropOneIndexNotAffectOtherIndexesOnSameColumnTest)NonExistentColumnIndexTestand the drop tests.be/test/storage/index/inverted/empty_index_file_test.cpp@@ -22,0 +23 @@@@ -23,0 +25 @@IndexFileReaderfor empty/missing error-code assertions.@@ -25,0 +28 @@@@ -33 +36 @@ constexpr int64_t NUM_STREAM = 3;@@ -76,0 +80,52 @@ protected:FileWriterrecords begin/finish close state and failures without relying on a concrete writer type.@@ -104,9 +159,11 @@ TEST_P(EmptyIndexFileTest, PreservesZeroByteFileWhenNoLogicalIndexes) {StreamSinkFileWriterand verify one EOS per stream with no data.@@ -119,0 +177,117 @@ TEST_P(EmptyIndexFileTest, PreservesZeroByteFileWhenNoLogicalIndexes) {be/test/storage/variant/index_storage_variant_debug_point_test.cpp@@ -150,5 +150,2 @@ protected:regression-test/suites/inverted_index_p0/test_empty_index_file_lifecycle.groovy@@ -0,0 +1,178 @@557150e08942a2234b48414952ab35eaaf718596.regression-test/suites/inverted_index_p0/test_variant_empty_index_file.groovyd701fcc160d6289125fd56f93fee10c669487c24.Check List (For Reviewer who merge this PR)