mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix processing pending batch for Distributed async INSERT after restart
After abnormal server restart current_batch.txt (that contains list of files to send to the remote shard), may not have all files, if it was terminated between unlink .bin files and truncation of current_batch.txt But it should be fixed in a more reliable way, though to backport the patch I kept it simple. Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
25912a2673
commit
f2a023140e
@ -201,6 +201,14 @@ void DistributedAsyncInsertBatch::sendBatch()
|
|||||||
{
|
{
|
||||||
for (const auto & file : files)
|
for (const auto & file : files)
|
||||||
{
|
{
|
||||||
|
/// In case of recovery it is possible that some of files will be
|
||||||
|
/// missing, if server had been restarted abnormally
|
||||||
|
if (recovered && !fs::exists(file))
|
||||||
|
{
|
||||||
|
LOG_WARNING(parent.log, "File {} does not exists, likely due abnormal shutdown", file);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ReadBufferFromFile in(file);
|
ReadBufferFromFile in(file);
|
||||||
const auto & distributed_header = DistributedAsyncInsertHeader::read(in, parent.log);
|
const auto & distributed_header = DistributedAsyncInsertHeader::read(in, parent.log);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user