MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / checkByCompressedReadBuffer

Function checkByCompressedReadBuffer

programs/check-marks/CheckMarks.cpp:21–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 */
20
21static void checkByCompressedReadBuffer(const std::string & mrk_path, const std::string & bin_path)
22{
23 DB::ReadBufferFromFile mrk_in(mrk_path);
24 DB::CompressedReadBufferFromFile bin_in(DB::createReadBufferFromFileBase(bin_path, /* settings= */ {}));
25
26 DB::WriteBufferFromFileDescriptor out(STDOUT_FILENO);
27 bool mrk2_format = mrk_path.ends_with(".mrk2");
28
29 for (size_t mark_num = 0; !mrk_in.eof(); ++mark_num)
30 {
31 UInt64 offset_in_compressed_file = 0;
32 UInt64 offset_in_decompressed_block = 0;
33 UInt64 index_granularity_rows = 0;
34
35 DB::readBinary(offset_in_compressed_file, mrk_in);
36 DB::readBinary(offset_in_decompressed_block, mrk_in);
37
38 out << "Mark " << mark_num << ", points to " << offset_in_compressed_file << ", " << offset_in_decompressed_block;
39
40 if (mrk2_format)
41 {
42 DB::readBinary(index_granularity_rows, mrk_in);
43
44 out << ", has rows after " << index_granularity_rows;
45 }
46
47 bin_in.seek(offset_in_compressed_file, offset_in_decompressed_block);
48 out << ", decompressed size " << bin_in.available();
49
50 out << ".\n" << DB::flush;
51
52 out.finalize();
53 }
54}
55
56
57int mainEntryClickHouseCheckMarks(int argc, char ** argv);

Callers 1

Calls 6

readBinaryFunction · 0.50
eofMethod · 0.45
seekMethod · 0.45
availableMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected