hello-stephen commented on code in PR #71104:
URL: https://github.com/apache/doris/pull/71104#discussion_r4727442437


##########
be/src/storage/segment/variant/v2/variant_column_writer.cpp:
##########
@@ -197,9 +199,25 @@ Status VariantV2ColumnWriter::_write_materialized(const 
VariantShreddedColumns&
         RETURN_IF_ERROR(variant_writer_helpers::append_sparse_converted_column(
                 tablet_column, writer.get(), converter, current_column_id, 
path_column.type,
                 path_column.column, path_column.rowids, _num_rows));
-        _subcolumn_indexes.push_back(std::move(indexes));
-        _subcolumn_opts.push_back(opts);
-        _subcolumn_writers.push_back(std::move(writer));
+        // Drain this path before the next writer allocates its page and index 
builders.
+        RETURN_IF_ERROR(writer->finish());
+        RETURN_IF_ERROR(writer->write_data());
+        const uint64_t index_start = _opts.file_writer->bytes_appended();
+        RETURN_IF_ERROR(writer->write_ordinal_index());
+        if (opts.need_zone_map) {
+            RETURN_IF_ERROR(writer->write_zone_map());
+        }
+        if (opts.need_bloom_filter) {
+            RETURN_IF_ERROR(writer->write_bloom_filter_index());
+        }
+        const uint64_t index_size = _opts.file_writer->bytes_appended() - 
index_start;
+        if (index_size != 0 && _opts.early_index_ranges != nullptr) {
+            _opts.early_index_ranges->push_back({index_start, index_size});
+        }
+        if (opts.need_inverted_index) {
+            // Finalize the column index while the segment still owns its 
files for packing.
+            RETURN_IF_ERROR(writer->write_inverted_index());

Review Comment:
   [P2] Preserve abort cleanup for eagerly finished disk indexes
   
   With `inverted_index_ram_dir_enable=false`, a V2 VARIANT with two indexed 
materialized string paths can finish path A here and then fail while writing 
path B's data or ordinal index. `InvertedIndexColumnWriter::finish()` clears 
`_index_writer`, so A's destructor no longer calls `close_on_error()` to remove 
its temporary directory. The flush returns before 
`IndexFileWriter::begin_close()`, and neither that writer's default destructor 
nor rowset cleanup deletes the separate tmp directory. Previously, A's builder 
was still unfinished on this failure path and removed the directory. Failed 
loads can therefore accumulate full-text index files until BE restart. Please 
add abort cleanup for completed path directories at the segment/index-file 
owner.



-- 
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]

Reply via email to