aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/Distributed/DistributedAsyncInsertBatch.h
blob: 867a0de89fa972404ce49fb7f939852322792cca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

#include <string>
#include <vector>

namespace DB
{

class DistributedAsyncInsertDirectoryQueue;
class WriteBuffer;
class ReadBuffer;

class DistributedAsyncInsertBatch
{
public:
    explicit DistributedAsyncInsertBatch(DistributedAsyncInsertDirectoryQueue & parent_);

    bool isEnoughSize() const;
    void send();

    void serialize();
    void deserialize();

    size_t total_rows = 0;
    size_t total_bytes = 0;
    std::vector<std::string> files;

private:
    void writeText(WriteBuffer & out);
    void readText(ReadBuffer & in);
    void sendBatch();
    void sendSeparateFiles();

    DistributedAsyncInsertDirectoryQueue & parent;

    /// Does the batch had been created from the files in current_batch.txt?
    bool recovered = false;

    bool split_batch_on_failure = true;
    bool fsync = false;
    bool dir_fsync = false;
};

}