PragmaTwice commented on code in PR #3072:
URL: https://github.com/apache/kvrocks/pull/3072#discussion_r2224167740


##########
src/storage/redis_metadata.cc:
##########
@@ -537,3 +537,25 @@ rocksdb::Status TDigestMetadata::Decode(Slice *input) {
 
   return rocksdb::Status::OK();
 }
+
+void TimeSeriesMetadata::Encode(std::string *dst) const {
+  Metadata::Encode(dst);
+  PutFixed64(dst, retention_time);
+  PutFixed64(dst, chunk_size);
+  PutFixed8(dst, static_cast<uint8_t>(chunk_type));
+  PutFixed8(dst, static_cast<uint8_t>(duplicate_policy));
+  PutSizedString(dst, source_key);
+}
+
+rocksdb::Status TimeSeriesMetadata::Decode(Slice *input) {
+  if (auto s = Metadata::Decode(input); !s.ok()) {
+    return s;
+  }
+  GetFixed64(input, &retention_time);

Review Comment:
   Should check if the remain length is long enough before the `GetFixed64`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to