Meng: Change RestoreConfigFR to Reference because FastRestore pass the Reference around
| 211 | // Meng: Change RestoreConfigFR to Reference<RestoreConfigFR> because FastRestore pass the Reference<RestoreConfigFR> |
| 212 | // around |
| 213 | ACTOR Future<std::string> RestoreConfigFR::getProgress_impl(Reference<RestoreConfigFR> restore, |
| 214 | Reference<ReadYourWritesTransaction> tr) { |
| 215 | tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); |
| 216 | tr->setOption(FDBTransactionOptions::LOCK_AWARE); |
| 217 | |
| 218 | state Future<int64_t> fileCount = restore->fileCount().getD(tr); |
| 219 | state Future<int64_t> fileBlockCount = restore->fileBlockCount().getD(tr); |
| 220 | state Future<int64_t> fileBlocksDispatched = restore->filesBlocksDispatched().getD(tr); |
| 221 | state Future<int64_t> fileBlocksFinished = restore->fileBlocksFinished().getD(tr); |
| 222 | state Future<int64_t> bytesWritten = restore->bytesWritten().getD(tr); |
| 223 | state Future<StringRef> status = restore->stateText(tr); |
| 224 | state Future<Version> lag = restore->getApplyVersionLag(tr); |
| 225 | state Future<std::string> tag = restore->tag().getD(tr); |
| 226 | state Future<std::pair<std::string, Version>> lastError = restore->lastError().getD(tr); |
| 227 | |
| 228 | // restore might no longer be valid after the first wait so make sure it is not needed anymore. |
| 229 | state UID uid = restore->getUid(); |
| 230 | wait(success(fileCount) && success(fileBlockCount) && success(fileBlocksDispatched) && |
| 231 | success(fileBlocksFinished) && success(bytesWritten) && success(status) && success(lag) && success(tag) && |
| 232 | success(lastError)); |
| 233 | |
| 234 | std::string errstr = "None"; |
| 235 | if (lastError.get().second != 0) |
| 236 | errstr = format("'%s' %llds ago.\n", |
| 237 | lastError.get().first.c_str(), |
| 238 | (tr->getReadVersion().get() - lastError.get().second) / CLIENT_KNOBS->CORE_VERSIONSPERSECOND); |
| 239 | |
| 240 | TraceEvent("FileRestoreProgress") |
| 241 | .detail("RestoreUID", uid) |
| 242 | .detail("Tag", tag.get()) |
| 243 | .detail("State", status.get().toString()) |
| 244 | .detail("FileCount", fileCount.get()) |
| 245 | .detail("FileBlocksFinished", fileBlocksFinished.get()) |
| 246 | .detail("FileBlocksTotal", fileBlockCount.get()) |
| 247 | .detail("FileBlocksInProgress", fileBlocksDispatched.get() - fileBlocksFinished.get()) |
| 248 | .detail("BytesWritten", bytesWritten.get()) |
| 249 | .detail("ApplyLag", lag.get()) |
| 250 | .detail("TaskInstance", THIS_ADDR) |
| 251 | .backtrace(); |
| 252 | |
| 253 | return format("Tag: %s UID: %s State: %s Blocks: %lld/%lld BlocksInProgress: %lld Files: %lld BytesWritten: " |
| 254 | "%lld ApplyVersionLag: %lld LastError: %s", |
| 255 | tag.get().c_str(), |
| 256 | uid.toString().c_str(), |
| 257 | status.get().toString().c_str(), |
| 258 | fileBlocksFinished.get(), |
| 259 | fileBlockCount.get(), |
| 260 | fileBlocksDispatched.get() - fileBlocksFinished.get(), |
| 261 | fileCount.get(), |
| 262 | bytesWritten.get(), |
| 263 | lag.get(), |
| 264 | errstr.c_str()); |
| 265 | } |
| 266 | Future<std::string> RestoreConfigFR::getProgress(Reference<ReadYourWritesTransaction> tr) { |
| 267 | Reference<RestoreConfigFR> restore = Reference<RestoreConfigFR>(this); |
| 268 | return getProgress_impl(restore, tr); |
nothing calls this directly
no test coverage detected