未验证 提交 1444ccb8 编写于 作者: A alexey-milovidov 提交者: GitHub

Merge pull request #19206 from azat/dist-pull

Tiny changes in DistributedBlockOutputStream
......@@ -145,6 +145,7 @@ void DistributedBlockOutputStream::writeAsync(const Block & block)
if (random_shard_insert)
{
writeAsyncImpl(block, storage.getRandomShardIndex(cluster->getShardsInfo()));
++inserted_blocks;
}
else
{
......@@ -352,7 +353,12 @@ DistributedBlockOutputStream::runWritingJob(DistributedBlockOutputStream::JobRep
/// Forward user settings
job.local_context = std::make_unique<Context>(context);
/// InterpreterInsertQuery is modifying the AST, but the same AST is also used to insert to remote shards.
/// Copying of the query AST is required to avoid race,
/// in case of INSERT into multiple local shards.
///
/// Since INSERT into local node uses AST,
/// and InterpreterInsertQuery::execute() is modifying it,
/// to resolve tables (in InterpreterInsertQuery::getTable())
auto copy_query_ast = query_ast->clone();
InterpreterInsertQuery interp(copy_query_ast, *job.local_context);
......@@ -608,7 +614,7 @@ void DistributedBlockOutputStream::writeToShard(const Block & block, const std::
/// tmp directory is used to ensure atomicity of transactions
/// and keep monitor thread out from reading incomplete data
std::string first_file_tmp_path{};
std::string first_file_tmp_path;
auto reservation = storage.getStoragePolicy()->reserveAndCheck(block.bytes());
const auto disk = reservation->getDisk();
......@@ -649,6 +655,8 @@ void DistributedBlockOutputStream::writeToShard(const Block & block, const std::
NativeBlockOutputStream stream{compress, DBMS_TCP_PROTOCOL_VERSION, block.cloneEmpty()};
/// Prepare the header.
/// See also readDistributedHeader() in DirectoryMonitor (for reading side)
///
/// We wrap the header into a string for compatibility with older versions:
/// a shard will able to read the header partly and ignore other parts based on its version.
WriteBufferFromOwnString header_buf;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册