| 444 | } |
| 445 | |
| 446 | static void serialise_log_files( |
| 447 | const std::string& dbtxndir, |
| 448 | const std::string& dbdir, |
| 449 | long long& log_number, bool complete_only) |
| 450 | // Scan the dbtxndir directory for log files that we can archive, starting with |
| 451 | // log file log_number. If complete_only is set then we will only archive |
| 452 | // completed logs (a log is complete if the next log file in the sequence |
| 453 | // already exists). Otherwise we keep going until there are no more log files. |
| 454 | { |
| 455 | char logfile[32]; |
| 456 | std::string absfile, storename; |
| 457 | struct stat st; |
| 458 | |
| 459 | // Find the highest existing log file |
| 460 | long long highest_log = log_number - 1; |
| 461 | while(true) { |
| 462 | snprintf(logfile, sizeof(logfile), "log.%010lld", highest_log + 1); |
| 463 | makeabs(absfile, dbtxndir, logfile); |
| 464 | if(stat(absfile.c_str(), &st) == -1) { |
| 465 | break; |
| 466 | } |
| 467 | highest_log++; |
| 468 | } |
| 469 | |
| 470 | // If we only want complete files, don't include it |
| 471 | if(complete_only) { |
| 472 | highest_log--; |
| 473 | } |
| 474 | |
| 475 | // Archive whatever's in between |
| 476 | while(log_number <= highest_log) { |
| 477 | snprintf(logfile, sizeof(logfile), "log.%010lld", log_number); |
| 478 | std::cerr<<"Serializing "<<logfile<<std::endl; |
| 479 | makeabs(absfile, dbtxndir, logfile); |
| 480 | FileInfo fi(FileInfo::LOG_FILE, absfile, dbdir); |
| 481 | serialise_file(fi); |
| 482 | log_number++; |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | static void strip_cluster(const std::string& lrlpath, |
| 487 | const std::string& lrldest) |
no test coverage detected