This is an automated email from the ASF dual-hosted git repository.
airborne12 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 7e634e472b1 [refactor](be) Keep CLucene out of the shared index file
headers (#70272)
7e634e472b1 is described below
commit 7e634e472b17a610f88b499ecb240f0714b02d28
Author: Jack <[email protected]>
AuthorDate: Tue Nov 24 09:09:08 2026 +0800
[refactor](be) Keep CLucene out of the shared index file headers (#70272)
### What problem does this PR solve?
Issue Number: None
Related PR: #70263, #70271 (depends on)
Problem Summary: Stop the index file headers shared with V1/V2 from
pulling CLucene into SNII and ANN code. Also fix four sources that did
not build without unity batches.
---
be/src/storage/index/index_common.h | 5 +--
be/src/storage/index/index_disk_usage.cpp | 1 +
be/src/storage/index/index_file_reader.cpp | 18 ++++++++++
be/src/storage/index/index_file_reader.h | 40 +++++++---------------
be/src/storage/index/index_file_writer.h | 26 ++++++--------
be/src/storage/index/index_fs_directory.cpp | 2 +-
be/src/storage/index/index_storage_format.h | 9 +++++
be/src/storage/index/index_storage_format_v1.cpp | 1 +
be/src/storage/index/index_storage_format_v2.cpp | 1 +
.../inverted/clucene/clucene_index_reader.cpp | 1 +
.../inverted/clucene/inverted_index_writer.cpp | 3 +-
.../storage/index/inverted/clucene/term_iterator.h | 2 +-
.../inverted/reader/collection_statistics.cpp | 1 +
.../index/inverted/snii/snii_index_reader.cpp | 5 +--
be/src/storage/rowset/beta_rowset.cpp | 1 +
.../function/search/function_search_null_test.cpp | 1 +
.../exprs/function/search/function_search_test.cpp | 1 +
be/test/storage/index/clucene_terms.h | 1 +
be/test/storage/index/index_common_test.cpp | 1 +
.../analysis/golden/analysis_write_golden_test.cpp | 1 +
.../compaction/util/index_compaction_utils.h | 1 +
.../query/engine/boolean_postings_bench_test.cpp | 2 +-
.../query/engine/phrase_postings_bench_test.cpp | 2 +-
.../inverted/query/engine/phrase_query_test.cpp | 1 +
.../query/engine/segment_postings_test.cpp | 1 +
.../inverted/snii/snii_ann_container_test.cpp | 1 +
.../inverted/snii/snii_clucene_guard_test.cpp | 11 ------
.../storage/rowset/segment_flusher_format_test.cpp | 2 +-
.../segment/inverted_index_file_reader_test.cpp | 1 +
.../storage/segment/inverted_index_writer_test.cpp | 1 +
build-support/check-header-deps.py | 16 ++-------
.../tests/test-build-hygiene-header-deps.sh | 27 ++++++++-------
32 files changed, 97 insertions(+), 90 deletions(-)
diff --git a/be/src/storage/index/index_common.h
b/be/src/storage/index/index_common.h
index cf19c047dfc..fc48662b28f 100644
--- a/be/src/storage/index/index_common.h
+++ b/be/src/storage/index/index_common.h
@@ -51,6 +51,9 @@ struct TermDeleter {
};
using TermPtr = std::unique_ptr<lucene::index::Term, TermDeleter>;
+// The templates of this header are defined in index_common_impl.h, which
includes CLucene, and
+// only the V1/V2 code that instantiates them includes it: SNII and ANN reach
this header through
+// the shared index file headers and do not use CLucene.
template <typename... Args>
TermPtr make_term_ptr(Args&&... args);
@@ -122,5 +125,3 @@ void finally_close(PtrType& resource, ErrorContext&
error_context);
#endif
} // namespace doris::segment_v2
-
-#include "storage/index/index_common_impl.h"
\ No newline at end of file
diff --git a/be/src/storage/index/index_disk_usage.cpp
b/be/src/storage/index/index_disk_usage.cpp
index 2927410e84e..2f83c2c78f7 100644
--- a/be/src/storage/index/index_disk_usage.cpp
+++ b/be/src/storage/index/index_disk_usage.cpp
@@ -34,6 +34,7 @@
#include "common/check.h"
#include "io/io_common.h"
#include "storage/index/ann/ann_index_files.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/inverted/common/inverted_index_desc.h"
#include "storage/index/inverted/snii/format/dict_entry.h"
diff --git a/be/src/storage/index/index_file_reader.cpp
b/be/src/storage/index/index_file_reader.cpp
index cf7b25408fb..bc9150843e5 100644
--- a/be/src/storage/index/index_file_reader.cpp
+++ b/be/src/storage/index/index_file_reader.cpp
@@ -32,6 +32,17 @@
namespace doris::segment_v2 {
+IndexFileReader::IndexFileReader(io::FileSystemSPtr fs, std::string
index_path_prefix,
+ InvertedIndexStorageFormatPB storage_format,
+ InvertedIndexFileInfo idx_file_info, int64_t
tablet_id)
+ : _fs(std::move(fs)),
+ _index_path_prefix(std::move(index_path_prefix)),
+ _storage_format(storage_format),
+ _idx_file_info(std::move(idx_file_info)),
+ _tablet_id(tablet_id) {}
+
+IndexFileReader::~IndexFileReader() = default;
+
Status IndexFileReader::init(int32_t read_buffer_size, const io::IOContext*
io_ctx) {
std::unique_lock<std::shared_mutex> lock(_mutex); // Lock for writing
if (!_inited) {
@@ -215,6 +226,13 @@ Result<InvertedIndexDirectoryMap>
IndexFileReader::get_all_directories() {
return res;
}
+int64_t IndexFileReader::get_inverted_file_size() const {
+ if (_storage_format == InvertedIndexStorageFormatPB::SNII) {
+ return _snii_file_reader == nullptr ? 0 : _snii_file_reader->size();
+ }
+ return _stream == nullptr ? 0 : _stream->length();
+}
+
Result<std::unique_ptr<DorisCompoundReader, DirectoryDeleter>>
IndexFileReader::_open(
int64_t index_id, const std::string& index_suffix, const
io::IOContext* io_ctx) const {
// No SNII index is a CLucene directory: text and BKD indexes have readers
of
diff --git a/be/src/storage/index/index_file_reader.h
b/be/src/storage/index/index_file_reader.h
index 381ff6186c9..8189e409fca 100644
--- a/be/src/storage/index/index_file_reader.h
+++ b/be/src/storage/index/index_file_reader.h
@@ -17,20 +17,6 @@
#pragma once
-// CLucene is third-party code and is not clean under -Wconversion (which
-// -Wshorten-64-to-32 belongs to). Whether its first expansion lands inside
-// someone else's suppressed region depends on include order, so suppress it
-// deliberately here (same pattern as index_common_impl.h).
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-#endif
-#include <CLucene.h> // IWYU pragma: keep
-#include <CLucene/store/IndexInput.h>
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
-
#include <gen_cpp/olap_file.pb.h>
#include <map>
@@ -53,6 +39,12 @@
#include "storage/index/inverted/snii/snii_bkd_searcher.h"
#include "storage/index/inverted/snii/snii_doris_adapter.h"
+// SNII and ANN include this header and use no CLucene, so the input of a V2
file is only declared
+// here.
+namespace lucene::store {
+class IndexInput;
+} // namespace lucene::store
+
namespace doris {
class TabletIndex;
namespace segment_v2 {
@@ -71,16 +63,13 @@ public:
using IndicesEntriesMap =
std::map<std::pair<int64_t, std::string>,
std::unique_ptr<EntriesType>>;
+ // The constructor and the destructor are out of line: both may destroy
_stream and the
+ // entries, whose types are incomplete here.
IndexFileReader(io::FileSystemSPtr fs, std::string index_path_prefix,
InvertedIndexStorageFormatPB storage_format,
InvertedIndexFileInfo idx_file_info =
InvertedIndexFileInfo(),
- int64_t tablet_id = -1)
- : _fs(std::move(fs)),
- _index_path_prefix(std::move(index_path_prefix)),
- _storage_format(storage_format),
- _idx_file_info(std::move(idx_file_info)),
- _tablet_id(tablet_id) {}
- virtual ~IndexFileReader() = default;
+ int64_t tablet_id = -1);
+ virtual ~IndexFileReader();
MOCK_FUNCTION Status init(int32_t read_buffer_size =
config::inverted_index_read_buffer_size,
const io::IOContext* io_ctx = nullptr);
@@ -142,12 +131,7 @@ public:
Status has_null(const TabletIndex* index_meta, bool* res) const;
Result<InvertedIndexDirectoryMap> get_all_directories();
// open file v2, init _stream
- int64_t get_inverted_file_size() const {
- if (_storage_format == InvertedIndexStorageFormatPB::SNII) {
- return _snii_file_reader == nullptr ? 0 :
_snii_file_reader->size();
- }
- return _stream == nullptr ? 0 : _stream->length();
- }
+ int64_t get_inverted_file_size() const;
const std::string& get_index_path_prefix() const { return
_index_path_prefix; }
InvertedIndexStorageFormatPB get_storage_format() const { return
_storage_format; }
friend IndexFileWriter;
@@ -161,7 +145,7 @@ protected:
private:
IndicesEntriesMap _indices_entries;
- std::unique_ptr<CL_NS(store)::IndexInput> _stream = nullptr;
+ std::unique_ptr<lucene::store::IndexInput> _stream = nullptr;
std::shared_ptr<snii_doris::DorisSniiFileReader> _snii_file_reader;
std::unique_ptr<doris::snii::reader::SniiSegmentReader>
_snii_segment_reader;
const io::FileSystemSPtr _fs;
diff --git a/be/src/storage/index/index_file_writer.h
b/be/src/storage/index/index_file_writer.h
index eb0f14c6e45..606d7218855 100644
--- a/be/src/storage/index/index_file_writer.h
+++ b/be/src/storage/index/index_file_writer.h
@@ -17,22 +17,11 @@
#pragma once
-// CLucene is third-party code and is not clean under -Wconversion (which
-// -Wshorten-64-to-32 belongs to). Whether its first expansion lands inside
-// someone else's suppressed region depends on include order, so suppress it
-// deliberately here (same pattern as index_common_impl.h).
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-#endif
-#include <CLucene.h> // IWYU pragma: keep
-#include <CLucene/store/IndexInput.h>
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
#include <gen_cpp/olap_common.pb.h>
#include <gen_cpp/olap_file.pb.h>
+#include <map>
+#include <memory>
#include <optional>
#include <string>
#include <utility>
@@ -43,14 +32,19 @@
#include "io/fs/file_writer.h"
#include "io/fs/local_file_system.h"
#include "storage/index/index_common.h"
-#include "storage/index/index_compound_reader.h"
#include "storage/index/index_storage_format.h"
#include "storage/index/inverted/analysis/gram/gram_scheme.h"
-#include "storage/index/inverted/clucene/inverted_index_searcher.h"
#include "storage/index/inverted/snii/format/format_constants.h"
#include "storage/index/inverted/snii/snii_doris_adapter.h"
#include "storage/index/inverted/snii/writer/snii_compound_writer.h"
+// SNII and ANN include this header and use no CLucene, so the CLucene types
of the V1 and V2
+// paths (lucene::store::Directory, DorisCompoundReader, IndexSearcherBuilder)
are only declared
+// here: the header names them through pointers, and the .cpp includes their
headers.
+namespace lucene::store {
+class Directory;
+} // namespace lucene::store
+
namespace doris::snii::writer {
class MemoryReporter;
class SpimiTermBuffer;
@@ -62,7 +56,9 @@ class TabletIndex;
namespace segment_v2 {
class AnnIndexSink;
+class DorisCompoundReader;
class DorisFSDirectory;
+class IndexSearcherBuilder;
namespace snii_doris {
class DorisSniiFileWriter;
class SniiAnnStaging;
diff --git a/be/src/storage/index/index_fs_directory.cpp
b/be/src/storage/index/index_fs_directory.cpp
index 739c7740e4f..4b7caad53dc 100644
--- a/be/src/storage/index/index_fs_directory.cpp
+++ b/be/src/storage/index/index_fs_directory.cpp
@@ -23,7 +23,7 @@
#include "common/status.h"
#include "io/fs/file_reader.h"
#include "io/fs/file_writer.h"
-#include "storage/index/index_common.h"
+#include "storage/index/index_common_impl.h"
#include "storage/index/inverted/common/inverted_index_desc.h"
#include "storage/tablet/tablet_schema.h"
#include "util/debug_points.h"
diff --git a/be/src/storage/index/index_storage_format.h
b/be/src/storage/index/index_storage_format.h
index 4e976232132..4d6b609b676 100644
--- a/be/src/storage/index/index_storage_format.h
+++ b/be/src/storage/index/index_storage_format.h
@@ -17,9 +17,18 @@
#pragma once
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <vector>
+
#include "common/status.h"
#include "storage/index/index_common.h"
+namespace lucene::store {
+class IndexOutput;
+} // namespace lucene::store
+
namespace doris::segment_v2 {
class IndexFileWriter;
diff --git a/be/src/storage/index/index_storage_format_v1.cpp
b/be/src/storage/index/index_storage_format_v1.cpp
index 3494068918b..c1318cae898 100644
--- a/be/src/storage/index/index_storage_format_v1.cpp
+++ b/be/src/storage/index/index_storage_format_v1.cpp
@@ -18,6 +18,7 @@
#include "storage/index/index_storage_format_v1.h"
#include "common/cast_set.h"
+#include "storage/index/index_common_impl.h"
#include "storage/index/index_file_writer.h"
#include "storage/index/index_fs_directory.h"
#include "storage/index/inverted/common/inverted_index_desc.h"
diff --git a/be/src/storage/index/index_storage_format_v2.cpp
b/be/src/storage/index/index_storage_format_v2.cpp
index c831d24d05a..1ccd1841d08 100644
--- a/be/src/storage/index/index_storage_format_v2.cpp
+++ b/be/src/storage/index/index_storage_format_v2.cpp
@@ -18,6 +18,7 @@
#include "storage/index/index_storage_format_v2.h"
#include "common/cast_set.h"
+#include "storage/index/index_common_impl.h"
#include "storage/index/index_file_writer.h"
#include "storage/index/index_fs_directory.h"
#include "storage/index/inverted/common/inverted_index_desc.h"
diff --git a/be/src/storage/index/inverted/clucene/clucene_index_reader.cpp
b/be/src/storage/index/inverted/clucene/clucene_index_reader.cpp
index 17e75604484..1c264b8961f 100644
--- a/be/src/storage/index/inverted/clucene/clucene_index_reader.cpp
+++ b/be/src/storage/index/inverted/clucene/clucene_index_reader.cpp
@@ -47,6 +47,7 @@
#include "runtime/runtime_profile.h"
#include "runtime/runtime_state.h"
#include "storage/index/bkd_field_encoding.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_fs_directory.h"
#include "storage/index/index_reader_helper.h"
diff --git a/be/src/storage/index/inverted/clucene/inverted_index_writer.cpp
b/be/src/storage/index/inverted/clucene/inverted_index_writer.cpp
index 8ab07724ccd..7b61a909e9c 100644
--- a/be/src/storage/index/inverted/clucene/inverted_index_writer.cpp
+++ b/be/src/storage/index/inverted/clucene/inverted_index_writer.cpp
@@ -17,11 +17,12 @@
#include "storage/index/inverted/clucene/inverted_index_writer.h"
-#include "storage/index/index_common.h"
+#include "storage/index/index_common_impl.h"
#include "storage/index/index_file_writer.h"
#include "storage/index/index_fs_directory.h"
#include "storage/index/inverted/analysis/analyzer/analyzer.h"
#include "storage/index/inverted/clucene/lucene_analyzer_bridge.h"
+#include "storage/index/inverted/common/inverted_index_desc.h"
#include "storage/key_coder.h"
#include "storage/tablet/tablet_schema.h"
#include "util/faststring.h"
diff --git a/be/src/storage/index/inverted/clucene/term_iterator.h
b/be/src/storage/index/inverted/clucene/term_iterator.h
index e2bc049cf71..8f6939695a9 100644
--- a/be/src/storage/index/inverted/clucene/term_iterator.h
+++ b/be/src/storage/index/inverted/clucene/term_iterator.h
@@ -24,7 +24,7 @@
#include "CLucene/index/Terms.h"
#include "common/be_mock_util.h"
-#include "storage/index/index_common.h"
+#include "storage/index/index_common_impl.h"
CL_NS_USE(index)
diff --git a/be/src/storage/index/inverted/reader/collection_statistics.cpp
b/be/src/storage/index/inverted/reader/collection_statistics.cpp
index 0d7bf65073a..2e70c7cdbf4 100644
--- a/be/src/storage/index/inverted/reader/collection_statistics.cpp
+++ b/be/src/storage/index/inverted/reader/collection_statistics.cpp
@@ -33,6 +33,7 @@
#include "exprs/vliteral.h"
#include "exprs/vslot_ref.h"
#include "runtime/thread_context.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_reader_helper.h"
#include "storage/index/inverted/analysis/analyzer/analyzer.h"
diff --git a/be/src/storage/index/inverted/snii/snii_index_reader.cpp
b/be/src/storage/index/inverted/snii/snii_index_reader.cpp
index 01bf82f46a1..28687cf3257 100644
--- a/be/src/storage/index/inverted/snii/snii_index_reader.cpp
+++ b/be/src/storage/index/inverted/snii/snii_index_reader.cpp
@@ -17,7 +17,6 @@
#include "storage/index/inverted/snii/snii_index_reader.h"
-#include <CLucene/util/stringUtil.h>
#include <fmt/format.h>
#include <algorithm>
@@ -42,6 +41,7 @@
#include "storage/index/inverted/analysis/gram/gram_family.h"
#include "storage/index/inverted/analysis/gram/gram_scheme.h"
#include "storage/index/inverted/common/inverted_index_cache.h"
+#include "storage/index/inverted/common/string_helper.h"
#include "storage/index/inverted/inverted_index_iterator.h"
#include "storage/index/inverted/query/exec/docid_sink.h"
#include "storage/index/inverted/query/exec/roaring_docid_sink.h"
@@ -307,7 +307,8 @@ Status SniiIndexReader::_run_leaf(const
IndexQueryContextPtr& context,
const index_query::logical::Node& leaf,
const roaring::Roaring* candidates, bool
scoring,
std::shared_ptr<roaring::Roaring>* out) {
- const std::wstring field = StringUtil::string_to_wstring(column_name);
+ // The same conversion as predicate_collector's: the collection statistics
are keyed by field.
+ const std::wstring field =
inverted_index::StringHelper::to_wstring(column_name);
auto source = _bind_source(context, field, index);
const uint32_t doc_count = source->doc_count();
auto result = std::make_shared<roaring::Roaring>();
diff --git a/be/src/storage/rowset/beta_rowset.cpp
b/be/src/storage/rowset/beta_rowset.cpp
index 9266da66ed5..d3066c9ced2 100644
--- a/be/src/storage/rowset/beta_rowset.cpp
+++ b/be/src/storage/rowset/beta_rowset.cpp
@@ -40,6 +40,7 @@
#include "io/fs/local_file_system.h"
#include "io/fs/path.h"
#include "io/fs/remote_file_system.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/inverted/common/inverted_index_cache.h"
#include "storage/index/inverted/common/inverted_index_desc.h"
diff --git a/be/test/exprs/function/search/function_search_null_test.cpp
b/be/test/exprs/function/search/function_search_null_test.cpp
index 5fc2f6bba1f..b6e34ad339a 100644
--- a/be/test/exprs/function/search/function_search_null_test.cpp
+++ b/be/test/exprs/function/search/function_search_null_test.cpp
@@ -37,6 +37,7 @@
#include "exprs/function/search/function_search.h"
#include "runtime/exec_env.h"
#include "runtime/runtime_state.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_query_context.h"
#include "storage/index/inverted/analysis/inverted_index_parser.h"
diff --git a/be/test/exprs/function/search/function_search_test.cpp
b/be/test/exprs/function/search/function_search_test.cpp
index 109c9c7dcdd..3296350f873 100644
--- a/be/test/exprs/function/search/function_search_test.cpp
+++ b/be/test/exprs/function/search/function_search_test.cpp
@@ -66,6 +66,7 @@
#include "runtime/exec_env.h"
#include "runtime/index_policy/index_policy_mgr.h"
#include "runtime/runtime_state.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_iterator.h"
#include "storage/index/inverted/analysis/analyzer/analyzer.h"
diff --git a/be/test/storage/index/clucene_terms.h
b/be/test/storage/index/clucene_terms.h
index 87310b30337..4e6737a99ea 100644
--- a/be/test/storage/index/clucene_terms.h
+++ b/be/test/storage/index/clucene_terms.h
@@ -28,6 +28,7 @@
#include <vector>
#include "io/fs/local_file_system.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/tablet/tablet_schema.h"
diff --git a/be/test/storage/index/index_common_test.cpp
b/be/test/storage/index/index_common_test.cpp
index b7c76b73398..8fae118cd7e 100644
--- a/be/test/storage/index/index_common_test.cpp
+++ b/be/test/storage/index/index_common_test.cpp
@@ -20,6 +20,7 @@
#include <gtest/gtest.h>
#include "common/status.h"
+#include "storage/index/index_common_impl.h"
namespace doris::segment_v2 {
diff --git
a/be/test/storage/index/inverted/analysis/golden/analysis_write_golden_test.cpp
b/be/test/storage/index/inverted/analysis/golden/analysis_write_golden_test.cpp
index 96c0d0e03b0..2196a0db645 100644
---
a/be/test/storage/index/inverted/analysis/golden/analysis_write_golden_test.cpp
+++
b/be/test/storage/index/inverted/analysis/golden/analysis_write_golden_test.cpp
@@ -39,6 +39,7 @@
#include "common/config.h"
#include "common/status.h"
#include "io/fs/local_file_system.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_file_writer.h"
#include "storage/index/index_writer.h"
diff --git
a/be/test/storage/index/inverted/clucene/compaction/util/index_compaction_utils.h
b/be/test/storage/index/inverted/clucene/compaction/util/index_compaction_utils.h
index ecb6493ecbb..141cfd582f0 100644
---
a/be/test/storage/index/inverted/clucene/compaction/util/index_compaction_utils.h
+++
b/be/test/storage/index/inverted/clucene/compaction/util/index_compaction_utils.h
@@ -33,6 +33,7 @@
#include "json2pb/json_to_pb.h"
#include "json2pb/pb_to_json.h"
#include "storage/compaction/base_compaction.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_query_context.h"
#include "storage/index/inverted/clucene/clucene_index_reader.h"
diff --git
a/be/test/storage/index/inverted/query/engine/boolean_postings_bench_test.cpp
b/be/test/storage/index/inverted/query/engine/boolean_postings_bench_test.cpp
index 3ad30e12d74..8b39629521c 100644
---
a/be/test/storage/index/inverted/query/engine/boolean_postings_bench_test.cpp
+++
b/be/test/storage/index/inverted/query/engine/boolean_postings_bench_test.cpp
@@ -30,7 +30,7 @@
#include <vector>
#include "io/fs/local_file_system.h"
-#include "storage/index/index_common.h"
+#include "storage/index/index_common_impl.h"
#include "storage/index/index_iterator.h"
#include "storage/index/inverted/analysis/analyzer/custom_analyzer.h"
#include "storage/index/inverted/clucene/lucene_analyzer_bridge.h"
diff --git
a/be/test/storage/index/inverted/query/engine/phrase_postings_bench_test.cpp
b/be/test/storage/index/inverted/query/engine/phrase_postings_bench_test.cpp
index 64edc210284..479b635c818 100644
--- a/be/test/storage/index/inverted/query/engine/phrase_postings_bench_test.cpp
+++ b/be/test/storage/index/inverted/query/engine/phrase_postings_bench_test.cpp
@@ -29,7 +29,7 @@
#include <vector>
#include "io/fs/local_file_system.h"
-#include "storage/index/index_common.h"
+#include "storage/index/index_common_impl.h"
#include "storage/index/inverted/analysis/analyzer/custom_analyzer.h"
#include "storage/index/inverted/clucene/lucene_analyzer_bridge.h"
#include "storage/index/inverted/clucene/spi/clucene_index_source.h"
diff --git a/be/test/storage/index/inverted/query/engine/phrase_query_test.cpp
b/be/test/storage/index/inverted/query/engine/phrase_query_test.cpp
index ba60a7d2572..4dc9196520f 100644
--- a/be/test/storage/index/inverted/query/engine/phrase_query_test.cpp
+++ b/be/test/storage/index/inverted/query/engine/phrase_query_test.cpp
@@ -31,6 +31,7 @@
#include "common/status.h"
#include "io/fs/local_file_system.h"
+#include "storage/index/index_common_impl.h"
#include "storage/index/index_query_context.h"
#include "storage/index/inverted/analysis/analyzer/custom_analyzer.h"
#include "storage/index/inverted/clucene/lucene_analyzer_bridge.h"
diff --git
a/be/test/storage/index/inverted/query/engine/segment_postings_test.cpp
b/be/test/storage/index/inverted/query/engine/segment_postings_test.cpp
index 06951645cef..5950e4bced4 100644
--- a/be/test/storage/index/inverted/query/engine/segment_postings_test.cpp
+++ b/be/test/storage/index/inverted/query/engine/segment_postings_test.cpp
@@ -29,6 +29,7 @@
#include "CLucene/index/DocRange.h"
#include "CLucene/index/MultiReader.h"
+#include "storage/index/index_common_impl.h"
#include "storage/index/inverted/clucene/spi/clucene_index_source.h"
#include "storage/index/inverted/clucene/spi/clucene_postings_cursor.h"
#include "storage/index/inverted/query/engine/phrase_query/phrase_scorer.h"
diff --git a/be/test/storage/index/inverted/snii/snii_ann_container_test.cpp
b/be/test/storage/index/inverted/snii/snii_ann_container_test.cpp
index 9053670de68..90fa518a66a 100644
--- a/be/test/storage/index/inverted/snii/snii_ann_container_test.cpp
+++ b/be/test/storage/index/inverted/snii/snii_ann_container_test.cpp
@@ -45,6 +45,7 @@
#include "storage/index/ann/ann_index_storage.h"
#include "storage/index/ann/ann_index_writer.h"
#include "storage/index/ann/ann_search_params.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_file_writer.h"
#include "storage/index/inverted/common/inverted_index_desc.h"
diff --git a/be/test/storage/index/inverted/snii/snii_clucene_guard_test.cpp
b/be/test/storage/index/inverted/snii/snii_clucene_guard_test.cpp
index d0defc34806..877da38c497 100644
--- a/be/test/storage/index/inverted/snii/snii_clucene_guard_test.cpp
+++ b/be/test/storage/index/inverted/snii/snii_clucene_guard_test.cpp
@@ -137,17 +137,6 @@ TEST(SniiCluceneDecouplingGuardTest, CoreHasNoCluceneRef) {
if (entry.path().parent_path() == *snii_core_dir) {
continue;
}
- // Narrow exemption: compaction eligibility resolves the DESTINATION
- // index's analyzer through Doris's analyzer stack, whose factory is
- // CLucene-backed and throws CLuceneError. That resolution is
- // integration work that currently lives one directory deep; until it
- // moves behind an integration-layer factory, this single file may
- // reference CLucene. Keep the exemption to exactly this file so any
- // new core reference still fails the guard.
- if (entry.path().parent_path().filename() == "compaction" &&
- entry.path().filename() == "eligibility.cpp") {
- continue;
- }
++scanned_files;
if (!scan_file_for_clucene(entry.path(), &hits)) {
unreadable.push_back(entry.path().string());
diff --git a/be/test/storage/rowset/segment_flusher_format_test.cpp
b/be/test/storage/rowset/segment_flusher_format_test.cpp
index 192e10107a0..4170218dd2f 100644
--- a/be/test/storage/rowset/segment_flusher_format_test.cpp
+++ b/be/test/storage/rowset/segment_flusher_format_test.cpp
@@ -67,7 +67,7 @@
#include "storage/index/ann/ann_index_reader.h"
#include "storage/index/ann/ann_search_params.h"
#include "storage/index/bloom_filter/bloom_filter_index_reader.h"
-#include "storage/index/index_common.h"
+#include "storage/index/index_common_impl.h"
#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_file_writer.h"
diff --git a/be/test/storage/segment/inverted_index_file_reader_test.cpp
b/be/test/storage/segment/inverted_index_file_reader_test.cpp
index 22c086ecd1d..c5e288d2df8 100644
--- a/be/test/storage/segment/inverted_index_file_reader_test.cpp
+++ b/be/test/storage/segment/inverted_index_file_reader_test.cpp
@@ -29,6 +29,7 @@
#include "io/fs/local_file_system.h"
#include "runtime/exec_env.h"
#include "storage/data_dir.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_file_writer.h"
#include "storage/index/index_fs_directory.h"
diff --git a/be/test/storage/segment/inverted_index_writer_test.cpp
b/be/test/storage/segment/inverted_index_writer_test.cpp
index 56ba1166458..c622e6c80a2 100644
--- a/be/test/storage/segment/inverted_index_writer_test.cpp
+++ b/be/test/storage/segment/inverted_index_writer_test.cpp
@@ -49,6 +49,7 @@
#include "runtime/index_policy/index_policy_mgr.h"
#include "runtime/runtime_state.h"
#include "storage/index/clucene_terms.h"
+#include "storage/index/index_compound_reader.h"
#include "storage/index/index_file_reader.h"
#include "storage/index/index_file_writer.h"
#include "storage/index/index_fs_directory.h"
diff --git a/build-support/check-header-deps.py
b/build-support/check-header-deps.py
index 73203af5227..31fb94dad93 100755
--- a/build-support/check-header-deps.py
+++ b/build-support/check-header-deps.py
@@ -643,21 +643,9 @@ CLUCENE_WHY = (
# task that cuts it lands. A missing entry and an entry that no longer breaks
the rule both fail
# the gate, so the tables only shrink.
# Files that include a CLucene header and are under a root or reached from one.
-CLUCENE_INCLUDING_FILES = {
- # Shared index file headers the roots reach (T11 to T13).
- "storage/index/index_common_impl.h",
- "storage/index/index_compound_reader.h",
- "storage/index/index_file_reader.h",
- "storage/index/index_file_writer.h",
- "storage/index/inverted/clucene/inverted_index_searcher.h",
- # SNII (T3, T13).
- "storage/index/inverted/snii/snii_index_reader.cpp",
-}
+CLUCENE_INCLUDING_FILES = set()
# Files under a root whose code names a CLucene symbol.
-CLUCENE_SYMBOL_FILES = {
- # SNII (T3, T13).
- "storage/index/inverted/snii/snii_index_reader.cpp",
-}
+CLUCENE_SYMBOL_FILES = set()
def load_includes():
diff --git a/build-support/tests/test-build-hygiene-header-deps.sh
b/build-support/tests/test-build-hygiene-header-deps.sh
index f49765ee2c9..5da96404ae3 100755
--- a/build-support/tests/test-build-hygiene-header-deps.sh
+++ b/build-support/tests/test-build-hygiene-header-deps.sh
@@ -47,7 +47,7 @@ TARGETS=(
"be/src/storage/index/inverted/query/spi/index_source.h"
"be/src/storage/index/inverted/query/engine/intersection.cpp"
"be/src/storage/index/inverted/common/query_info.h"
- "be/src/storage/index/inverted/snii/snii_index_reader.cpp"
+ "build-support/check-header-deps.py"
"be/src/storage/index/ann/ann_index_writer.h"
"be/src/storage/index/ann/ann_index_storage.h"
)
@@ -135,15 +135,20 @@ echo "${OUT}" | grep -q "query/engine/intersection.cpp
includes <CLucene.h>" \
cp "${BACKUP}/be/src/storage/index/inverted/query/engine/intersection.cpp" \
"${ROOT}/be/src/storage/index/inverted/query/engine/intersection.cpp"
-# An exception that no longer breaks the rule fails the gate.
-sed -i '/#include <CLucene/d'
"${ROOT}/be/src/storage/index/inverted/snii/snii_index_reader.cpp"
+# An exception that no longer breaks the rule fails the gate. The tables are
empty, so the probe
+# lists a clean file under a root, query_info.h. Written into the existing
file, which keeps its
+# mode: e.g. "CLUCENE_INCLUDING_FILES = set()" becomes a set holding that one
entry.
+add_clucene_exception() {
+ awk -v table="$1 = set()" -v entry="$1 = {\"$2\"}" '{ print ($0 == table ?
entry : $0) }' \
+ "${BACKUP}/build-support/check-header-deps.py" > "${GATE}"
+}
+add_clucene_exception CLUCENE_INCLUDING_FILES
"storage/index/inverted/common/query_info.h"
OUT="$(run_gate)"; EC=$?
[ "${EC}" -eq 1 ] || fail "stale CLucene include exception expected exit 1,
got ${EC}"
echo "${OUT}" | grep -q \
- "CLUCENE_INCLUDING_FILES lists
storage/index/inverted/snii/snii_index_reader.cpp" \
+ "CLUCENE_INCLUDING_FILES lists storage/index/inverted/common/query_info.h"
\
|| fail "stale CLucene include exception not reported"
-cp "${BACKUP}/be/src/storage/index/inverted/snii/snii_index_reader.cpp" \
- "${ROOT}/be/src/storage/index/inverted/snii/snii_index_reader.cpp"
+cat "${BACKUP}/build-support/check-header-deps.py" > "${GATE}"
# The ANN index is CLucene-free and has no exception: a CLucene include in one
of its headers fails.
printf '\n#include <CLucene.h>\n' >>
"${ROOT}/be/src/storage/index/ann/ann_index_writer.h"
@@ -168,16 +173,14 @@ echo "${OUT}" | grep -q "common/query_info.h:[0-9]* names
the CLucene symbol luc
cp "${BACKUP}/be/src/storage/index/inverted/common/query_info.h" \
"${ROOT}/be/src/storage/index/inverted/common/query_info.h"
-# A symbol exception that no longer breaks the rule fails the gate.
-sed -i 's/StringUtil/clucene_gate_probe_util/g' \
- "${ROOT}/be/src/storage/index/inverted/snii/snii_index_reader.cpp"
+# A symbol exception that no longer breaks the rule fails the gate; the same
made-up entry.
+add_clucene_exception CLUCENE_SYMBOL_FILES
"storage/index/inverted/common/query_info.h"
OUT="$(run_gate)"; EC=$?
[ "${EC}" -eq 1 ] || fail "stale CLucene symbol exception expected exit 1, got
${EC}"
echo "${OUT}" | grep -q \
- "CLUCENE_SYMBOL_FILES lists
storage/index/inverted/snii/snii_index_reader.cpp" \
+ "CLUCENE_SYMBOL_FILES lists storage/index/inverted/common/query_info.h" \
|| fail "stale CLucene symbol exception not reported"
-cp "${BACKUP}/be/src/storage/index/inverted/snii/snii_index_reader.cpp" \
- "${ROOT}/be/src/storage/index/inverted/snii/snii_index_reader.cpp"
+cat "${BACKUP}/build-support/check-header-deps.py" > "${GATE}"
# A CLucene symbol in ANN code fails the gate as well.
printf '\ninline lucene::store::Directory* clucene_gate_ann_symbol =
nullptr;\n' \
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]