PragmaTwice commented on code in PR #1342:
URL: 
https://github.com/apache/incubator-kvrocks/pull/1342#discussion_r1144597882


##########
src/storage/redis_metadata.h:
##########
@@ -97,22 +97,45 @@ class InternalKey {
   bool slot_id_encoded_;
 };
 
+constexpr uint8_t METADATA_64BIT_ENCODING_MASK = 0x80;
+constexpr uint8_t METADATA_TYPE_MASK = 0x0f;
+
 class Metadata {
  public:
+  // metadata flags
+  // <(1-bit) 64bit-common-field-indicator> 0 0 0 <(4-bit) redis-type>
+  // 64bit-common-field-indicator: make `expire` and `size` 64bit instead of 
32bit
+  // NOTE: `expire` is stored in milliseconds for 64bit, seconds for 32bit
+  // redis-type: RedisType for the key-value
   uint8_t flags;
-  int expire;
+
+  // expire timestamp, in milliseconds
+  uint64_t expire;
+
+  // the current version: 53bit timestamp + 11bit counter
   uint64_t version;
-  uint32_t size;
 
- public:
-  explicit Metadata(RedisType type, bool generate_version = true);
+  // element size of the key-value
+  uint64_t size;
+
+  explicit Metadata(RedisType type, bool generate_version = true, bool 
use_64bit_common_field = true);

Review Comment:
   But I am thinking if we set the parameter to `false` to allow users rollback 
to previous kvrocks versions (i.e. users cannot rollback (e.g. to 2.3.0) when 
they use the new encoding to write some data, although these old data will be 
treat as well). Do you have some idea?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to