airborne12 opened a new pull request, #71177:
URL: https://github.com/apache/doris/pull/71177
### What problem does this PR solve?
Issue Number: None
Related PR: #66262
Problem Summary:
Pick of apache/doris#66262 (squash commit 1cd8d296d69) to branch-4.1.
`runtime/exec_env.h` included
`storage/index/inverted/inverted_index_writer.h`
although it only names index types as pointers that are already forward
declared. Because most of BE reaches `exec_env.h`, that dead include put the
whole inverted index writer stack, and CLucene through it, in front of almost
every translation unit. The pick removes the include, moves the
`BE_TEST`-only
`ExecEnv::set_tmp_file_dir` body to `exec_env.cpp` so `TmpFileDirs` can stay
forward declared, adds the explicit includes that sources and tests had been
getting by accident, and adds `build-support/check-header-deps.py`, which
fails when `exec_env.h` can reach `storage/index/` again.
Measured on branch-4.1 with the reverse include graph of
`check-header-deps.py`, translation units that include each header, before ->
after this pick:
| header | before | after |
| --- | ---: | ---: |
| `storage/index/inverted/inverted_index_writer.h` | 1830 | 142 |
| `storage/index/index_file_writer.h` | 1832 | 250 |
Pick type: cherry-pick with conflicts. Two files conflicted, each on one
added
`#include`:
- `be/test/storage/index/index_builder_test.cpp`: branch-4.1 has `#include
<set>`
and `#include "storage/index/index_file_reader.h"` at that spot (from
#68082,
the 4.1 pick of #67859), which the source tree does not. Kept both and
added
`#include "storage/index/index_writer.h"` after them, as in the source.
- `be/test/storage/index/inverted/empty_index_file_test.cpp`: branch-4.1
already
includes `storage/index/index_writer.h` here (also from #68082) and adds
`storage/index/inverted/inverted_index_desc.h` after it. Kept the
branch-4.1
side; the source hunk is already satisfied, so this file has no change.
The other 17 files apply with hunks identical to the source.
One branch-4.1-only fix: the BE unit test build failed in
`be/test/storage/index/inverted/query_v2/prefix_query_test.cpp` with
`-Werror,-Wshadow-field` in CLucene's `CLucene/util/Array.h`. On branch-4.1
that test reaches `runtime/exec_env.h` through `index_query_context.h`, and
the removed include used to parse CLucene there under an existing
`-Wshadow-field` suppression. Now `prefix_weight.h` is the first header in
that test to include CLucene, and its pragma block only ignored
`-Woverloaded-virtual`. The pick adds `-Wshadow-field` to that clang pragma
block, the same suppression `inverted_index_searcher.h` and
`query_v2/collect/multi_segment_util.h` use around CLucene. The source tree
does not hit this. No other branch-4.1 file needed a change.
`check-header-deps.py` is added as a standalone script, as in the source; it
is not wired into the build or CI.
Hunk audit against 1cd8d296d69:
| File | Source hunks | Status |
| --- | --- | --- |
| be/src/runtime/exec_env.cpp | `@@ -31,6 +31,7 @@`, `@@ -44,6 +45,9 @@` |
Ported (verbatim) |
| be/src/runtime/exec_env.h | `@@ -35,7 +35,6 @@`, `@@ -318,11 +317,14 @@` |
Ported (verbatim) |
| be/src/storage/index/index_file_writer.cpp | `@@ -30,6 +30,7 @@` | Ported
(verbatim) |
| be/src/storage/index/inverted/query_v2/prefix_query/prefix_weight.h | `@@
-24,6 +24,10 @@` | Ported; plus a branch-4.1-only `-Wshadow-field` ignore in
the same clang pragma block (see above) |
| be/src/storage/segment/encoding_info.h | `@@ -27,6 +27,7 @@` | Ported
(verbatim) |
| be/src/storage/tablet/tablet_schema.cpp | `@@ -43,6 +43,7 @@` | Ported
(verbatim) |
| be/src/storage/task/index_builder.cpp | `@@ -23,6 +23,7 @@` | Ported
(verbatim) |
| be/test/exprs/function/function_is_null_test.cpp | `@@ -20,6 +20,7 @@` |
Ported (verbatim) |
| be/test/io/fs/s3_file_writer_test.cpp | `@@ -59,6 +59,7 @@` | Ported
(verbatim) |
| be/test/storage/compaction/ordered_data_compaction_test.cpp | `@@ -49,6
+49,7 @@` | Ported (verbatim) |
| be/test/storage/index/index_builder_test.cpp | `@@ -20,6 +20,7 @@` |
Adapted: conflict, include added after 4.1's `index_file_reader.h` |
| be/test/storage/index/inverted/common/inverted_index_gc_binlogs_test.cpp |
`@@ -17,6 +17,7 @@` | Ported (verbatim) |
|
be/test/storage/index/inverted/compaction/index_compaction_performance_test.cpp
| `@@ -21,6 +21,7 @@` | Ported (verbatim) |
| be/test/storage/index/inverted/compaction/index_compaction_test.cpp | `@@
-17,6 +17,7 @@` | Ported (verbatim) |
| be/test/storage/index/inverted/empty_index_file_test.cpp | `@@ -22,6 +22,7
@@` | N-A: branch-4.1 already includes `storage/index/index_writer.h` (line 27,
from #68082) |
| be/test/storage/segment/inverted_index_compound_reader_test.cpp | `@@
-39,6 +39,7 @@` | Ported (verbatim) |
| be/test/storage/segment/inverted_index_file_reader_test.cpp | `@@ -28,6
+28,7 @@` | Ported (verbatim) |
| be/test/storage/segment/inverted_index_file_writer_test.cpp | `@@ -23,6
+23,7 @@` | Ported (verbatim) |
| build-support/check-header-deps.py | `@@ -0,0 +1,193 @@` (new file) |
Ported (verbatim) |
### Release note
None
### Check List (For Author)
- Test
- [ ] Regression test
- [x] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [x] No need to test or manual test. Explain why:
- [x] This is a refactor/code format and no logic has been changed.
Testing, local, `BUILD_TYPE=ASAN` and `BUILD_TYPE_UT=ASAN`, on this commit:
- `./build.sh --be -j 64`: passed.
- `./run-be-ut.sh -j 64`: passed after the `prefix_weight.h` fix above.
Before
it, the only failure was `prefix_query_test.cpp`.
- `./run-be-ut.sh --run --filter=...` over the suites in the touched test
files
plus the prefix-query tests (`FunctionIsNullTest`,
`OrderedDataCompactionTest`,
`IndexBuilderTest`, `IndexGcBinglogsTest`, `IndexCompactionTest`,
`EmptyIndexFileTest`, `DorisCompoundReaderTest`,
`InvertedIndexFileReaderTest`, `IndexFileWriterTest`, `PrefixQueryV2Test`,
`PhrasePrefixQueryV2Test`): 171/171 passed. All 162 test names defined in
those files ran (the parameterized `EmptyIndexFileTest` cases account for
the rest). No sanitizer report. `DISABLED_IndexCompactionPerformanceTest`
only builds.
- `S3FileWriterTest`, each case run on its own: 3 pass and 11 crash with an
ASAN SEGV in `FileCacheFactory::get_by_path` (no file cache factory in the
test environment while `enable_file_cache` defaults to true). This is
existing behavior: the unpatched branch-4.1 base (1786adf035e), built the
same way, gives the same 11 crashes with the same stack and the same 3
passes. This pick changes only an include in that test, and this PR does
not fix the crash.
- `build-support/check-header-deps.py`: passes on this commit. A copy run
against the unpatched branch-4.1 sources reports the
`exec_env.h -> inverted_index_writer.h -> index_file_writer.h` chain and
exits 1.
- clang-format 16 (`--dry-run --Werror`) on the 17 changed C++ files: clean.
- No regression test: the change only moves includes and a test-only setter;
it does not change runtime behavior.
- Behavior changed:
- [x] No.
- Does this need documentation?
- [x] No.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]