From db2cef844b326fd9e13b4a4385c8ce2235c816c5 Mon Sep 17 00:00:00 2001 From: Jingyu Zhou Date: Wed, 8 Apr 2020 22:52:23 -0700 Subject: [PATCH] Write mutation log type as a backup property This can solve the problem when listing log files returns empty results. --- fdbclient/BackupContainer.actor.cpp | 27 ++++++++++++++----- ...kupAndParallelRestoreCorrectness.actor.cpp | 1 - 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/fdbclient/BackupContainer.actor.cpp b/fdbclient/BackupContainer.actor.cpp index 2e713b39ee..27a64a53bf 100644 --- a/fdbclient/BackupContainer.actor.cpp +++ b/fdbclient/BackupContainer.actor.cpp @@ -723,10 +723,12 @@ public: state Optional metaLogEnd; state Optional metaExpiredEnd; state Optional metaUnreliableEnd; + state Optional metaLogType; std::vector> metaReads; metaReads.push_back(store(metaExpiredEnd, bc->expiredEndVersion().get())); metaReads.push_back(store(metaUnreliableEnd, bc->unreliableEndVersion().get())); + metaReads.push_back(store(metaLogType, bc->logType().get())); // Only read log begin/end versions if not doing a deep scan, otherwise scan files and recalculate them. if(!deepScan) { @@ -737,12 +739,13 @@ public: wait(waitForAll(metaReads)); TraceEvent("BackupContainerDescribe2") - .detail("URL", bc->getURL()) - .detail("LogStartVersionOverride", logStartVersionOverride) - .detail("ExpiredEndVersion", metaExpiredEnd.orDefault(invalidVersion)) - .detail("UnreliableEndVersion", metaUnreliableEnd.orDefault(invalidVersion)) - .detail("LogBeginVersion", metaLogBegin.orDefault(invalidVersion)) - .detail("LogEndVersion", metaLogEnd.orDefault(invalidVersion)); + .detail("URL", bc->getURL()) + .detail("LogStartVersionOverride", logStartVersionOverride) + .detail("ExpiredEndVersion", metaExpiredEnd.orDefault(invalidVersion)) + .detail("UnreliableEndVersion", metaUnreliableEnd.orDefault(invalidVersion)) + .detail("LogBeginVersion", metaLogBegin.orDefault(invalidVersion)) + .detail("LogEndVersion", metaLogEnd.orDefault(invalidVersion)) + .detail("LogType", metaLogType.orDefault(-1)); // If the logStartVersionOverride is positive (not relative) then ensure that unreliableEndVersion is equal or greater if(logStartVersionOverride != invalidVersion && metaUnreliableEnd.orDefault(invalidVersion) < logStartVersionOverride) { @@ -810,7 +813,7 @@ public: desc.partitioned = true; logs.swap(plogs); } else { - desc.partitioned = false; + desc.partitioned = metaLogType.present() && metaLogType.get() == PARTITIONED_MUTATION_LOG; } // List logs in version order so log continuity can be analyzed @@ -857,6 +860,11 @@ public: updates = updates && bc->logEndVersion().set(desc.contiguousLogEnd.get()); } + if (!metaLogType.present()) { + updates = updates && bc->logType().set(desc.partitioned ? PARTITIONED_MUTATION_LOG + : NON_PARTITIONED_MUTATION_LOG); + } + wait(updates); } catch(Error &e) { if(e.code() == error_code_actor_cancelled) @@ -1384,6 +1392,11 @@ public: VersionProperty expiredEndVersion() { return {Reference::addRef(this), "expired_end_version"}; } VersionProperty unreliableEndVersion() { return {Reference::addRef(this), "unreliable_end_version"}; } + // Backup log types + const static Version NON_PARTITIONED_MUTATION_LOG = 0; + const static Version PARTITIONED_MUTATION_LOG = 1; + VersionProperty logType() { return { Reference::addRef(this), "mutation_log_type" }; } + ACTOR static Future writeVersionProperty(Reference bc, std::string path, Version v) { try { state Reference f = wait(bc->writeFile(path)); diff --git a/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp b/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp index 3f00b5f781..66a07df408 100644 --- a/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp +++ b/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp @@ -218,7 +218,6 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload { if(!fdesc.isError()) { state BackupDescription desc = fdesc.get(); - ASSERT(self->usePartitionedLogs == desc.partitioned); wait(desc.resolveVersionTimes(cx)); printf("BackupDescription:\n%s\n", desc.toString().c_str()); restorable = desc.maxRestorableVersion.present();