aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Interpreters/FilesystemCacheLog.h
blob: 41a7c8e0fe6ef93b8ca90d5d1a0a71225ea23ede (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
46
47
48
49
50
51
52
53
54
#pragma once

#include <Core/NamesAndAliases.h>
#include <Core/NamesAndTypes.h>
#include <Core/Settings.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeNumberBase.h>
#include <DataTypes/DataTypeTuple.h>
#include <Interpreters/SystemLog.h>
#include <Interpreters/TransactionVersionMetadata.h>

namespace DB
{

struct FilesystemCacheLogElement
{
    enum class CacheType
    {
        READ_FROM_CACHE,
        READ_FROM_FS_AND_DOWNLOADED_TO_CACHE,
        READ_FROM_FS_BYPASSING_CACHE,
        WRITE_THROUGH_CACHE,
    };

    time_t event_time{};

    String query_id;
    String source_file_path;

    std::pair<size_t, size_t> file_segment_range{};
    std::pair<size_t, size_t> requested_range{};
    CacheType cache_type{};
    std::string file_segment_key{};
    size_t file_segment_offset = 0;
    size_t file_segment_size = 0;
    bool read_from_cache_attempted;
    String read_buffer_id{};
    std::shared_ptr<ProfileEvents::Counters::Snapshot> profile_counters = nullptr;

    static std::string name() { return "FilesystemCacheLog"; }

    static NamesAndTypesList getNamesAndTypes();
    static NamesAndAliases getNamesAndAliases() { return {}; }

    void appendToBlock(MutableColumns & columns) const;
    static const char * getCustomColumnList() { return nullptr; }
};

class FilesystemCacheLog : public SystemLog<FilesystemCacheLogElement>
{
    using SystemLog<FilesystemCacheLogElement>::SystemLog;
};

}