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

Method readText

src/Storages/MergeTree/ReplicatedMergeTreeLogEntry.cpp:220–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void ReplicatedMergeTreeLogEntryData::readText(ReadBuffer & in, MergeTreeDataFormatVersion partition_format_version)
221{
222 UInt8 format_version = 0;
223 String type_str;
224
225 in >> "format version: " >> format_version >> "\n";
226
227 if (format_version < 1 || format_version >= FORMAT_LAST)
228 throw Exception(ErrorCodes::UNKNOWN_FORMAT_VERSION, "Unknown ReplicatedMergeTreeLogEntry format version: {}",
229 DB::toString(format_version));
230
231 if (format_version >= FORMAT_WITH_CREATE_TIME)
232 {
233 LocalDateTime create_time_dt;
234 in >> "create_time: " >> create_time_dt >> "\n";
235 create_time = makeDateTime(DateLUT::serverTimezoneInstance(),
236 create_time_dt.year(), create_time_dt.month(), create_time_dt.day(),
237 create_time_dt.hour(), create_time_dt.minute(), create_time_dt.second());
238 }
239
240 in >> "source replica: " >> source_replica >> "\n";
241
242 if (format_version >= FORMAT_WITH_BLOCK_ID)
243 {
244 std::string block_hashes_string;
245 in >> "block_id: " >> escape >> block_hashes_string >> "\n";
246
247 if (!block_hashes_string.empty())
248 splitInto<','>(deduplication_block_ids, block_hashes_string, true);
249 }
250
251 if (format_version >= FORMAT_WITH_LOG_ENTRY_ID)
252 in >> "log_entry_id: " >> escape >> log_entry_id >> "\n";
253
254 in >> type_str >> "\n";
255
256 bool trailing_newline_found = false;
257
258 if (type_str == "get")
259 {
260 type = GET_PART;
261 in >> new_part_name;
262 }
263 else if (type_str == "attach")
264 {
265 type = ATTACH_PART;
266 in >> new_part_name >> "\npart_checksum: " >> part_checksum;
267 }
268 else if (type_str == "merge")
269 {
270 type = MERGE_PARTS;
271 while (true)
272 {
273 String s;
274 in >> s >> "\n";
275 if (s == "into")
276 break;
277 source_parts.push_back(s);

Callers 1

parseMethod · 0.45

Calls 15

makeDateTimeFunction · 0.85
checkAndGetMergeTypeFunction · 0.85
isFakeDropRangePartMethod · 0.80
toStringFunction · 0.70
ExceptionClass · 0.50
checkStringFunction · 0.50
typeToStringFunction · 0.50
readQuotedFunction · 0.50
yearMethod · 0.45
monthMethod · 0.45
dayMethod · 0.45
hourMethod · 0.45

Tested by

no test coverage detected