MCPcopy Create free account
hub / github.com/apple/foundationdb / getProgress_impl

Method getProgress_impl

fdbclient/FileBackupAgent.actor.cpp:349–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347typedef RestoreConfig::RestoreFile RestoreFile;
348
349ACTOR Future<std::string> RestoreConfig::getProgress_impl(RestoreConfig restore,
350 Reference<ReadYourWritesTransaction> tr) {
351 tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
352 tr->setOption(FDBTransactionOptions::LOCK_AWARE);
353
354 state Future<int64_t> fileCount = restore.fileCount().getD(tr);
355 state Future<int64_t> fileBlockCount = restore.fileBlockCount().getD(tr);
356 state Future<int64_t> fileBlocksDispatched = restore.filesBlocksDispatched().getD(tr);
357 state Future<int64_t> fileBlocksFinished = restore.fileBlocksFinished().getD(tr);
358 state Future<int64_t> bytesWritten = restore.bytesWritten().getD(tr);
359 state Future<StringRef> status = restore.stateText(tr);
360 state Future<Version> currentVersion = restore.getCurrentVersion(tr);
361 state Future<Version> lag = restore.getApplyVersionLag(tr);
362 state Future<Version> firstConsistentVersion = restore.firstConsistentVersion().getD(tr);
363 state Future<std::string> tag = restore.tag().getD(tr);
364 state Future<std::pair<std::string, Version>> lastError = restore.lastError().getD(tr);
365
366 // restore might no longer be valid after the first wait so make sure it is not needed anymore.
367 state UID uid = restore.getUid();
368 wait(success(fileCount) && success(fileBlockCount) && success(fileBlocksDispatched) &&
369 success(fileBlocksFinished) && success(bytesWritten) && success(status) && success(currentVersion) &&
370 success(lag) && success(firstConsistentVersion) && success(tag) && success(lastError));
371
372 std::string errstr = "None";
373 if (lastError.get().second != 0)
374 errstr = format("'%s' %" PRId64 "s ago.\n",
375 lastError.get().first.c_str(),
376 (tr->getReadVersion().get() - lastError.get().second) / CLIENT_KNOBS->CORE_VERSIONSPERSECOND);
377
378 TraceEvent("FileRestoreProgress")
379 .detail("RestoreUID", uid)
380 .detail("Tag", tag.get())
381 .detail("State", status.get().toString())
382 .detail("FileCount", fileCount.get())
383 .detail("FileBlocksFinished", fileBlocksFinished.get())
384 .detail("FileBlocksTotal", fileBlockCount.get())
385 .detail("FileBlocksInProgress", fileBlocksDispatched.get() - fileBlocksFinished.get())
386 .detail("BytesWritten", bytesWritten.get())
387 .detail("CurrentVersion", currentVersion.get())
388 .detail("FirstConsistentVersion", firstConsistentVersion.get())
389 .detail("ApplyLag", lag.get())
390 .detail("TaskInstance", THIS_ADDR);
391
392 return format("Tag: %s UID: %s State: %s Blocks: %lld/%lld BlocksInProgress: %lld Files: %lld BytesWritten: "
393 "%lld CurrentVersion: %lld FirstConsistentVersion: %lld ApplyVersionLag: %lld LastError: %s",
394 tag.get().c_str(),
395 uid.toString().c_str(),
396 status.get().toString().c_str(),
397 fileBlocksFinished.get(),
398 fileBlockCount.get(),
399 fileBlocksDispatched.get() - fileBlocksFinished.get(),
400 fileCount.get(),
401 bytesWritten.get(),
402 currentVersion.get(),
403 firstConsistentVersion.get(),
404 lag.get(),
405 errstr.c_str());
406}

Callers

nothing calls this directly

Calls 15

TraceEventClass · 0.85
getCurrentVersionMethod · 0.80
detailMethod · 0.80
setOptionMethod · 0.65
getMethod · 0.65
getReadVersionMethod · 0.65
formatFunction · 0.50
getDMethod · 0.45
fileCountMethod · 0.45
fileBlockCountMethod · 0.45
filesBlocksDispatchedMethod · 0.45

Tested by

no test coverage detected