remove useless version in macro data seq

This commit is contained in:
Fengjingkun
2023-11-27 07:47:00 +00:00
committed by ob-robot
parent ff37436df4
commit 585c33cf4b
2 changed files with 5 additions and 9 deletions

View File

@ -27,14 +27,12 @@ namespace blocksstable
struct ObMacroDataSeq struct ObMacroDataSeq
{ {
static const int64_t MACRO_DATA_SEQ_VERSION = 2;
static const int64_t BIT_DATA_SEQ = 32; static const int64_t BIT_DATA_SEQ = 32;
static const int64_t BIT_PARALLEL_IDX = 11; static const int64_t BIT_PARALLEL_IDX = 11;
static const int64_t BIT_BLOCK_TYPE = 3; static const int64_t BIT_BLOCK_TYPE = 3;
static const int64_t BIT_MERGE_TYPE = 2; static const int64_t BIT_MERGE_TYPE = 2;
static const int64_t BIT_SSTABLE_SEQ = 10; static const int64_t BIT_SSTABLE_SEQ = 10;
static const int64_t BIT_VERSION = 3; static const int64_t BIT_RESERVED = 5;
static const int64_t BIT_RESERVED = 2;
static const int64_t BIT_SIGN = 1; static const int64_t BIT_SIGN = 1;
static const int64_t MAX_PARALLEL_IDX = (0x1UL << BIT_PARALLEL_IDX) - 1; static const int64_t MAX_PARALLEL_IDX = (0x1UL << BIT_PARALLEL_IDX) - 1;
static const int64_t MAX_SSTABLE_SEQ = (0x1UL << BIT_SSTABLE_SEQ) - 1; static const int64_t MAX_SSTABLE_SEQ = (0x1UL << BIT_SSTABLE_SEQ) - 1;
@ -49,8 +47,8 @@ struct ObMacroDataSeq
REBUILD_MACRO_BLOCK_MERGE = 2, REBUILD_MACRO_BLOCK_MERGE = 2,
}; };
ObMacroDataSeq() : macro_data_seq_(0) { version_ = MACRO_DATA_SEQ_VERSION; } ObMacroDataSeq() : macro_data_seq_(0) {}
ObMacroDataSeq(const int64_t data_seq) : macro_data_seq_(data_seq) { version_ = MACRO_DATA_SEQ_VERSION; } ObMacroDataSeq(const int64_t data_seq) : macro_data_seq_(data_seq) {}
virtual ~ObMacroDataSeq() = default; virtual ~ObMacroDataSeq() = default;
ObMacroDataSeq &operator=(const ObMacroDataSeq &other) ObMacroDataSeq &operator=(const ObMacroDataSeq &other)
{ {
@ -61,7 +59,7 @@ struct ObMacroDataSeq
} }
bool operator ==(const ObMacroDataSeq &other) const { return macro_data_seq_ == other.macro_data_seq_; } bool operator ==(const ObMacroDataSeq &other) const { return macro_data_seq_ == other.macro_data_seq_; }
bool operator !=(const ObMacroDataSeq &other) const { return macro_data_seq_ != other.macro_data_seq_; } bool operator !=(const ObMacroDataSeq &other) const { return macro_data_seq_ != other.macro_data_seq_; }
OB_INLINE void reset() { macro_data_seq_ = 0; version_ = MACRO_DATA_SEQ_VERSION; } OB_INLINE void reset() { macro_data_seq_ = 0; }
OB_INLINE int64_t get_data_seq() const { return macro_data_seq_; } OB_INLINE int64_t get_data_seq() const { return macro_data_seq_; }
OB_INLINE int64_t get_parallel_idx() const { return parallel_idx_; } OB_INLINE int64_t get_parallel_idx() const { return parallel_idx_; }
OB_INLINE bool is_valid() const { return macro_data_seq_ >= 0; } OB_INLINE bool is_valid() const { return macro_data_seq_ >= 0; }
@ -103,7 +101,7 @@ struct ObMacroDataSeq
int deserialize(const char *buf, const int64_t data_len, int64_t &pos); int deserialize(const char *buf, const int64_t data_len, int64_t &pos);
int64_t get_serialize_size() const; int64_t get_serialize_size() const;
TO_STRING_KV(K_(data_seq), K_(parallel_idx), K_(block_type), K_(merge_type), TO_STRING_KV(K_(data_seq), K_(parallel_idx), K_(block_type), K_(merge_type),
K_(sstable_logic_seq), K_(version), K_(reserved), K_(sign), K_(macro_data_seq)); K_(sstable_logic_seq), K_(reserved), K_(sign), K_(macro_data_seq));
union union
{ {
int64_t macro_data_seq_; int64_t macro_data_seq_;
@ -114,7 +112,6 @@ struct ObMacroDataSeq
uint64_t block_type_ : BIT_BLOCK_TYPE; uint64_t block_type_ : BIT_BLOCK_TYPE;
uint64_t merge_type_ : BIT_MERGE_TYPE; uint64_t merge_type_ : BIT_MERGE_TYPE;
uint64_t sstable_logic_seq_ : BIT_SSTABLE_SEQ; uint64_t sstable_logic_seq_ : BIT_SSTABLE_SEQ;
uint64_t version_ : BIT_VERSION;
uint64_t reserved_ : BIT_RESERVED; uint64_t reserved_ : BIT_RESERVED;
uint64_t sign_ : BIT_SIGN; uint64_t sign_ : BIT_SIGN;
}; };

View File

@ -50,7 +50,6 @@ static void make_random_logic_id(blocksstable::ObLogicMacroBlockId &logic_id)
logic_id.tablet_id_ = random(1, 10000000); logic_id.tablet_id_ = random(1, 10000000);
blocksstable::ObMacroDataSeq seq; blocksstable::ObMacroDataSeq seq;
seq.macro_data_seq_ = random(1, 10000000); seq.macro_data_seq_ = random(1, 10000000);
seq.version_ = blocksstable::ObMacroDataSeq::MACRO_DATA_SEQ_VERSION;
logic_id.data_seq_ = seq; logic_id.data_seq_ = seq;
logic_id.logic_version_ = random(1, 10000000); logic_id.logic_version_ = random(1, 10000000);
} }