Skip to content

Commit 41ae596

Browse files
ucasflleefeng
authored andcommitted
Fix merge bugs due to path error
1 parent 3bd6368 commit 41ae596

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Storages/MergeTree/MergeTask.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -637,16 +637,16 @@ bool MergeTask::ExecuteAndFinalizeHorizontalPart::generateRowIdsMap()
637637

638638
/// inverted_row_ids_map file write buffer
639639
global_ctx->inverted_row_ids_map_uncompressed_buf = global_ctx->new_data_part->getDataPartStorage().writeFile(
640-
global_ctx->inverted_row_ids_map_file_path, 4096, global_ctx->context->getWriteSettings());
640+
fileName(global_ctx->inverted_row_ids_map_file_path), 4096, WriteMode::Rewrite, global_ctx->context->getWriteSettings());
641641
global_ctx->inverted_row_ids_map_buf = std::make_unique<CompressedWriteBuffer>(*global_ctx->inverted_row_ids_map_uncompressed_buf);
642642

643643
/// row_ids_map file write buffers
644644
global_ctx->row_ids_map_bufs.clear();
645645
global_ctx->row_ids_map_uncompressed_bufs.clear();
646646
for (const auto & row_ids_map_file : global_ctx->row_ids_map_files)
647647
{
648-
auto row_ids_map_uncompressed_buf
649-
= global_ctx->new_data_part->getDataPartStorage().writeFile(row_ids_map_file, 4096, global_ctx->context->getWriteSettings());
648+
auto row_ids_map_uncompressed_buf = global_ctx->new_data_part->getDataPartStorage().writeFile(
649+
fileName(row_ids_map_file), 4096, global_ctx->context->getWriteSettings());
650650
global_ctx->row_ids_map_bufs.emplace_back(std::make_unique<CompressedWriteBuffer>(*row_ids_map_uncompressed_buf));
651651
global_ctx->row_ids_map_uncompressed_bufs.emplace_back(std::move(row_ids_map_uncompressed_buf));
652652
}
@@ -823,7 +823,6 @@ bool MergeTask::ExecuteAndFinalizeHorizontalPart::generateRowIdsMap()
823823

824824
global_ctx->inverted_row_ids_map_buf.reset();
825825
global_ctx->inverted_row_ids_map_uncompressed_buf.reset();
826-
827826
throw;
828827
}
829828

@@ -1171,7 +1170,7 @@ bool MergeTask::MergeProjectionsStage::finalizeProjectionsAndWholeMerge() const
11711170
String inverted_row_sources_file_path
11721171
= global_ctx->new_data_part->getDataPartStorage().getFullPath() + "merged-inverted_row_sources_map" + VECTOR_INDEX_FILE_SUFFIX;
11731172
auto inverted_row_sources_map_uncompressed_buf = global_ctx->new_data_part->getDataPartStorage().writeFile(
1174-
inverted_row_sources_file_path, 4096, global_ctx->context->getWriteSettings());
1173+
fileName(inverted_row_sources_file_path), 4096, global_ctx->context->getWriteSettings());
11751174
auto inverted_row_sources_map_buf = std::make_unique<CompressedWriteBuffer>(*inverted_row_sources_map_uncompressed_buf);
11761175

11771176
DB::copyData(*rows_sources_read_buf, *inverted_row_sources_map_buf);
@@ -1180,7 +1179,7 @@ bool MergeTask::MergeProjectionsStage::finalizeProjectionsAndWholeMerge() const
11801179
inverted_row_sources_map_uncompressed_buf->finalize();
11811180

11821181
/// Previously we marked this tmp file to be kept
1183-
global_ctx->context->getTemporaryVolume()->getDisk()->removeFile(global_ctx->inverted_row_sources_map_file_path);
1182+
global_ctx->context->getTemporaryVolume()->getDisk()->removeFile(fileName(global_ctx->inverted_row_sources_map_file_path));
11841183

11851184
/// add merged-inverted_row_ids_map and merged-inverted_row_sources_map to vector_index_checksums_map
11861185
NameSet index_map_filenames

0 commit comments

Comments
 (0)