aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/Distributed/DistributedAsyncInsertHeader.h
blob: a7330fa5ef1b88488a741f5f7746299b9e8c98f7 (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
45
#pragma once

#include <Core/Settings.h>
#include <Core/Block.h>
#include <Interpreters/ClientInfo.h>
#include <base/types.h>
#include <string>

namespace DB
{

class ReadBufferFromFile;

namespace OpenTelemetry
{
struct TracingContextHolder;
using TracingContextHolderPtr = std::unique_ptr<TracingContextHolder>;
}

/// Header for the binary files that are stored on disk for async INSERT into Distributed.
struct DistributedAsyncInsertHeader
{
    UInt64 revision = 0;
    Settings insert_settings;
    std::string insert_query;
    ClientInfo client_info;

    /// .bin file cannot have zero rows/bytes.
    size_t rows = 0;
    size_t bytes = 0;

    UInt32 shard_num = 0;
    std::string cluster;
    std::string distributed_table;
    std::string remote_table;

    /// dumpStructure() of the header -- obsolete
    std::string block_header_string;
    Block block_header;

    static DistributedAsyncInsertHeader read(ReadBufferFromFile & in, Poco::Logger * log);
    OpenTelemetry::TracingContextHolderPtr createTracingContextHolder(const char * function, std::shared_ptr<OpenTelemetrySpanLog> open_telemetry_span_log) const;
};

}