Skip to content

Commit

Permalink
Fix merge bugs due to path error
Browse files Browse the repository at this point in the history
  • Loading branch information
ucasfl authored and leefeng committed Nov 8, 2024
1 parent 3bd6368 commit 41ae596
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Storages/MergeTree/MergeTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,16 +637,16 @@ bool MergeTask::ExecuteAndFinalizeHorizontalPart::generateRowIdsMap()

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

/// row_ids_map file write buffers
global_ctx->row_ids_map_bufs.clear();
global_ctx->row_ids_map_uncompressed_bufs.clear();
for (const auto & row_ids_map_file : global_ctx->row_ids_map_files)
{
auto row_ids_map_uncompressed_buf
= global_ctx->new_data_part->getDataPartStorage().writeFile(row_ids_map_file, 4096, global_ctx->context->getWriteSettings());
auto row_ids_map_uncompressed_buf = global_ctx->new_data_part->getDataPartStorage().writeFile(
fileName(row_ids_map_file), 4096, global_ctx->context->getWriteSettings());
global_ctx->row_ids_map_bufs.emplace_back(std::make_unique<CompressedWriteBuffer>(*row_ids_map_uncompressed_buf));
global_ctx->row_ids_map_uncompressed_bufs.emplace_back(std::move(row_ids_map_uncompressed_buf));
}
Expand Down Expand Up @@ -823,7 +823,6 @@ bool MergeTask::ExecuteAndFinalizeHorizontalPart::generateRowIdsMap()

global_ctx->inverted_row_ids_map_buf.reset();
global_ctx->inverted_row_ids_map_uncompressed_buf.reset();

throw;
}

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

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

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

/// add merged-inverted_row_ids_map and merged-inverted_row_sources_map to vector_index_checksums_map
NameSet index_map_filenames
Expand Down

0 comments on commit 41ae596

Please sign in to comment.