MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / deserialise_database

Function deserialise_database

tools/comdb2ar/deserialise.cpp:358–977  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356#define write_size (1000*1024)
357
358void deserialise_database(
359 const std::string *p_lrldestdir,
360 const std::string *p_datadestdir,
361 bool strip_cluster_info,
362 bool strip_consumer_info,
363 bool run_full_recovery,
364 const std::string& comdb2_task,
365 unsigned percent_full,
366 bool force_mode,
367 bool legacy_mode,
368 bool& is_disk_full,
369 bool run_with_done_file,
370 bool incr_mode,
371 bool dryrun
372)
373// Deserialise a database from serialised from received on stdin.
374// If lrldestdir and datadestdir are not NULL then the lrl and data files
375// will be placed accordingly. Otherwise the lrl file and the data files will
376// be placed in the same directory as specified in the serialised form.
377// The lrl file written out will be updated to reflect the resulting directory
378// structure. If the destination disk reaches or exceeds the specified
379// percent_full during the deserialisation then the operation is halted.
380{
381 static const char zero_head[512] = {0};
382 int stlen;
383 is_disk_full = false;
384 void *empty_page = NULL;
385 unsigned long long skipped_bytes = 0;
386 int rc =0;
387 std::vector<std::string> options;
388
389 bool file_is_sparse = false;
390
391 std::string fingerprint;
392
393 std::string done_file_string;
394
395 // This is the directory listing of the data directory taken at the time
396 // when we find the lrl file in out input stream and can therefore fix
397 // the data directory.
398 std::list<std::string> data_dir_files;
399
400 // The absolute path names of the files that we have already extracted.
401 std::set<std::string> extracted_files;
402
403 // List of known tables
404 std::set<std::string> table_set;
405
406 std::string datadestdir;
407
408 std::string fullpath;
409
410 empty_page = malloc(65536);
411 memset(empty_page, 0, 65536);
412
413 if (p_datadestdir == NULL && p_lrldestdir)
414 p_datadestdir = p_lrldestdir;
415

Callers 1

mainFunction · 0.85

Calls 15

mallocFunction · 0.85
ErrorClass · 0.85
listdirFunction · 0.85
readallFunction · 0.85
read_octal_ullFunction · 0.85
read_serialised_sha_fileFunction · 0.85
recognize_data_fileFunction · 0.85
output_fileFunction · 0.85
process_manifestFunction · 0.85
process_lrlFunction · 0.85
make_dirsFunction · 0.85

Tested by

no test coverage detected