]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/db/version_edit.cc
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / rocksdb / db / version_edit.cc
index 17362cb33ff09acb576816cacd9da0d1c2b5225f..bf5f178f2e3808493a3ee9dd5cec84579e429fed 100644 (file)
@@ -44,6 +44,9 @@ enum Tag : uint32_t {
   kInAtomicGroup = 300,
 };
 
+// Mask for an identified tag from the future which can be safely ignored.
+uint32_t kTagSafeIgnoreMask = 1 << 13;
+
 enum CustomTag : uint32_t {
   kTerminate = 1,  // The end of customized fields
   kNeedCompaction = 2,
@@ -281,7 +284,7 @@ const char* VersionEdit::DecodeNewFile4From(Slice* input) {
         break;
       }
       if (!GetLengthPrefixedSlice(input, &field)) {
-        return "new-file4 custom field lenth prefixed slice error";
+        return "new-file4 custom field length prefixed slice error";
       }
       switch (custom_tag) {
         case kPathId:
@@ -525,7 +528,21 @@ Status VersionEdit::DecodeFrom(const Slice& src) {
         break;
 
       default:
-        msg = "unknown tag";
+        if (tag & kTagSafeIgnoreMask) {
+          // Tag from future which can be safely ignored.
+          // The next field must be the length of the entry.
+          uint32_t field_len;
+          if (!GetVarint32(&input, &field_len) ||
+              static_cast<size_t>(field_len) > input.size()) {
+            if (!msg) {
+              msg = "safely ignoreable tag length error";
+            }
+          } else {
+            input.remove_prefix(static_cast<size_t>(field_len));
+          }
+        } else {
+          msg = "unknown tag";
+        }
         break;
     }
   }
@@ -603,7 +620,7 @@ std::string VersionEdit::DebugString(bool hex_key) const {
     AppendNumberTo(&r, max_column_family_);
   }
   if (is_in_atomic_group_) {
-    r.append("\n AtomicGroup: ");
+    r.append("\n  AtomicGroup: ");
     AppendNumberTo(&r, remaining_entries_);
     r.append(" entries remains");
   }