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

Method wait

src/Backups/BackupsWorker.cpp:1355–1374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1353
1354
1355BackupStatus BackupsWorker::wait(const OperationID & backup_or_restore_id, bool rethrow_exception)
1356{
1357 std::unique_lock lock{infos_mutex};
1358 BackupStatus current_status = {};
1359 status_changed.wait(lock, [&]
1360 {
1361 auto it = infos.find(backup_or_restore_id);
1362 if (it == infos.end())
1363 throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown backup ID {}", backup_or_restore_id);
1364 const auto & info = it->second.info;
1365 current_status = info.status;
1366 if (rethrow_exception && isFailedOrCancelled(current_status))
1367 std::rethrow_exception(info.exception);
1368 if (isFinalStatus(current_status))
1369 return true;
1370 LOG_INFO(log, "Waiting {} {} to complete", isBackupStatus(current_status) ? "backup" : "restore", info.name);
1371 return false;
1372 });
1373 return current_status;
1374}
1375
1376void BackupsWorker::waitAll()
1377{

Callers 5

stopWatchingThreadMethod · 0.45
waitHostsReachStageMethod · 0.45
waitMethod · 0.45
shutdownMethod · 0.45

Calls 6

isFailedOrCancelledFunction · 0.85
isFinalStatusFunction · 0.85
isBackupStatusFunction · 0.85
ExceptionClass · 0.50
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected