gavinchou commented on code in PR #53876:
URL: https://github.com/apache/doris/pull/53876#discussion_r2230536962
##########
cloud/src/recycler/checker.cpp:
##########
@@ -807,59 +838,208 @@ int InstanceChecker::do_inverted_check() {
return -1;
}
- if (!str.back().ends_with(".idx")) {
+ // v1: {rowset_id}_{seg_num}_{idx_id}{idx_suffix}.idx
+ // v2: {rowset_id}_{seg_num}.idx
+ std::string rowset_info = str.back();
+
+ if (!rowset_info.ends_with(".idx")) {
return 0; // Not an index file
}
- int64_t index_id;
+ InvertedIndexStorageFormatPB inverted_index_storage_format =
+ std::count(rowset_info.begin(), rowset_info.end(), '_') > 1
+ ? InvertedIndexStorageFormatPB::V1
+ : InvertedIndexStorageFormatPB::V2;
- size_t pos = str.back().find_last_of('_');
+ size_t pos = rowset_info.find_last_of('_');
if (pos == std::string::npos || pos + 1 >= str.back().size() - 4) {
LOG(WARNING) << "Invalid index_id format, key=" << obj_key;
return -1;
}
- index_id = atol(str.back().substr(pos + 1, str.back().size() -
4).c_str());
+ if (inverted_index_storage_format == InvertedIndexStorageFormatPB::V1)
{
Review Comment:
extract if else to 2 functions
--
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]