From 937597dd1c921936dbadff31661678c96ce5bb23 Mon Sep 17 00:00:00 2001 From: liuyihua Date: Fri, 7 Jun 2024 10:42:24 +0800 Subject: [PATCH] add compatible of old metadata --- db/c.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/db/c.cc b/db/c.cc index c65229f1f11..290f612d1ce 100644 --- a/db/c.cc +++ b/db/c.cc @@ -1088,9 +1088,12 @@ rocksdb_live_file_metadata* rocksdb_new_live_file_metadata( metadata->file_creation_time = file_creation_time; metadata->file_checksum = std::string(file_checksum); metadata->file_checksum_func_name = std::string(file_checksum_func_name); - metadata->epoch_number = epoch_number; - metadata->smallest = hex_to_string(std::string(hex_smallest)); - metadata->largest = hex_to_string(std::string(hex_largest)); + if ((epoch_number != 0) || (std::string(hex_smallest) != "") || + (std::string(hex_largest) != "")) { + metadata->epoch_number = epoch_number; + metadata->smallest = hex_to_string(std::string(hex_smallest)); + metadata->largest = hex_to_string(std::string(hex_largest)); + } rocksdb_live_file_metadata* result = new rocksdb_live_file_metadata; result->rep = metadata; return result;