File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,13 @@ InvertedIndexTantivy<T>::LoadIndexMetas(
215215 if (file_name.find (INDEX_NULL_OFFSET_FILE_NAME) != std::string::npos) {
216216 null_offset_files.push_back (file);
217217 }
218+
219+ // add slice meta file for null offset file compact
220+ if (file_name == INDEX_FILE_SLICE_META) {
221+ null_offset_files.push_back (file);
222+ }
218223 }
224+
219225 if (null_offset_files.size () > 0 ) {
220226 // null offset file is sliced
221227 auto index_datas =
@@ -243,6 +249,10 @@ InvertedIndexTantivy<T>::RetainTantivyIndexFiles(
243249 auto file_name =
244250 boost::filesystem::path (file).filename ().string ();
245251 return file_name == " index_type" ||
252+ // Slice meta is only used to compact null_offset files and non_exist_offset files.
253+ // It can be removed after compaction is complete.
254+ // Other index files are compacted by slice index instead of meta.
255+ file_name == INDEX_FILE_SLICE_META ||
246256 file_name.find (INDEX_NULL_OFFSET_FILE_NAME) !=
247257 std::string::npos;
248258 }),
Original file line number Diff line number Diff line change @@ -234,6 +234,10 @@ JsonInvertedIndex<T>::LoadIndexMetas(
234234 std::string::npos) {
235235 non_exist_offset_files.push_back (file);
236236 }
237+ // add slice meta file for null offset file compact
238+ if (file_name == INDEX_FILE_SLICE_META) {
239+ non_exist_offset_files.push_back (file);
240+ }
237241 }
238242 if (non_exist_offset_files.size () > 0 ) {
239243 // null offset file is sliced
You can’t perform that action at this time.
0 commit comments