github-actions[bot] commented on code in PR #30145:
URL: https://github.com/apache/doris/pull/30145#discussion_r1458626958
##########
be/src/olap/rowset/segment_v2/inverted_index_compound_directory.cpp:
##########
@@ -78,6 +80,132 @@
const char* const DorisCompoundDirectory::WRITE_LOCK_FILE = "write.lock";
const char* const DorisCompoundDirectory::COMPOUND_FILE_EXTENSION = ".idx";
+Status DorisMultiIndexCompoundWriter::initialize(
+ const std::vector<std::pair<int64_t, std::string>>& indices) {
+ for (const auto& index : indices) {
+ auto index_id = index.first;
+ auto index_suffix = index.second;
+ auto index_path = InvertedIndexDescriptor::get_temporary_index_path(
+ _segment_file_path + "/" + _segment_file_name, index_id,
index_suffix);
+
+ bool exists = false;
+ auto st = _fs->exists(index_path.c_str(), &exists);
+ if (!st.ok()) {
+ LOG(ERROR) << "index_path:" << index_path << " exists error:" <<
st;
+ return st;
+ }
+ if (!exists) {
+ return Status::Error<ErrorCode::INVERTED_INDEX_FILE_NOT_FOUND>(
+ "inverted index path not found:", index_path);
+ }
+ auto dir = DorisCompoundDirectoryFactory::getDirectory(_fs,
index_path.c_str());
+ _indices_dirs.insert(std::make_pair(index_id, dir));
+ }
+ return Status::OK();
+}
+
+size_t DorisMultiIndexCompoundWriter::headerLength() {
Review Comment:
warning: method 'headerLength' can be made static
[readability-convert-member-functions-to-static]
be/src/olap/rowset/segment_v2/inverted_index_compound_directory.h:80:
```diff
- size_t headerLength();
+ static size_t headerLength();
```
##########
be/src/olap/rowset/segment_v2/inverted_index_compound_directory.h:
##########
@@ -62,6 +68,25 @@ class DorisCompoundFileWriter : LUCENE_BASE {
CL_NS(store)::Directory* directory = nullptr;
};
+class DorisMultiIndexCompoundWriter : public DorisCompoundFileWriter {
+public:
+ DorisMultiIndexCompoundWriter(const io::FileSystemSPtr fs, std::string&
segment_file_path,
+ std::string& segment_file_name)
+ : _fs(fs),
+ _segment_file_path(segment_file_path),
+ _segment_file_name(segment_file_name) {}
+ Status initialize(const std::vector<std::pair<int64_t, std::string>>&
indices);
Review Comment:
warning: parameter 1 is const-qualified in the function declaration;
const-qualification of parameters only has an effect in function definitions
[readability-avoid-const-params-in-decls]
```suggestion
Status initialize(std::vector<std::pair<int64_t, std::string>>& indices);
```
##########
be/src/olap/rowset/segment_v2/inverted_index_compound_directory.cpp:
##########
@@ -78,6 +80,132 @@ namespace doris::segment_v2 {
const char* const DorisCompoundDirectory::WRITE_LOCK_FILE = "write.lock";
const char* const DorisCompoundDirectory::COMPOUND_FILE_EXTENSION = ".idx";
+Status DorisMultiIndexCompoundWriter::initialize(
Review Comment:
warning: method 'initialize' can be made static
[readability-convert-member-functions-to-static]
```suggestion
static Status DorisMultiIndexCompoundWriter::initialize(
```
--
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]