Added the continuity check of filled_tx_scn of minor sstable
This commit is contained in:
@ -69,6 +69,7 @@ ObSSTable::ObSSTable()
|
||||
contain_uncommitted_row_(false),
|
||||
valid_for_reading_(false),
|
||||
is_tmp_sstable_(false),
|
||||
filled_tx_scn_(share::SCN::min_scn()),
|
||||
meta_(nullptr)
|
||||
{
|
||||
#if defined(__x86_64__)
|
||||
@ -139,6 +140,7 @@ void ObSSTable::reset()
|
||||
meta_ = nullptr;
|
||||
valid_for_reading_ = false;
|
||||
is_tmp_sstable_ = false;
|
||||
filled_tx_scn_ = share::SCN::min_scn();
|
||||
ObITable::reset();
|
||||
}
|
||||
|
||||
@ -818,6 +820,7 @@ int ObSSTable::deep_copy(char *buf, const int64_t buf_len, ObIStorageMetaObj *&v
|
||||
pvalue->nested_offset_ = nested_offset_;
|
||||
pvalue->contain_uncommitted_row_ = contain_uncommitted_row_;
|
||||
pvalue->is_tmp_sstable_ = false;
|
||||
pvalue->filled_tx_scn_ = filled_tx_scn_;
|
||||
pvalue->valid_for_reading_ = valid_for_reading_;
|
||||
if (is_loaded()) {
|
||||
if (OB_FAIL(meta_->deep_copy(buf, buf_len, pos, pvalue->meta_))) {
|
||||
@ -935,6 +938,7 @@ int ObSSTable::deserialize(common::ObArenaAllocator &allocator,
|
||||
max_merged_trans_version_ = meta_->get_max_merged_trans_version();
|
||||
data_macro_block_count_ = meta_->get_data_macro_block_count();
|
||||
contain_uncommitted_row_ = meta_->contain_uncommitted_row();
|
||||
filled_tx_scn_ = meta_->get_filled_tx_scn();
|
||||
nested_size_ = meta_->get_macro_info().get_nested_size();
|
||||
nested_offset_ = meta_->get_macro_info().get_nested_offset();
|
||||
}
|
||||
@ -987,7 +991,8 @@ int64_t ObSSTable::get_sstable_fix_serialize_payload_size() const
|
||||
data_macro_block_count_,
|
||||
nested_size_,
|
||||
nested_offset_,
|
||||
contain_uncommitted_row_);
|
||||
contain_uncommitted_row_,
|
||||
filled_tx_scn_);
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -1019,7 +1024,8 @@ int ObSSTable::serialize_fixed_struct(char *buf, const int64_t buf_len, int64_t
|
||||
data_macro_block_count_,
|
||||
nested_size_,
|
||||
nested_offset_,
|
||||
contain_uncommitted_row_);
|
||||
contain_uncommitted_row_,
|
||||
filled_tx_scn_);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1050,7 +1056,8 @@ int ObSSTable::deserialize_fixed_struct(const char *buf, const int64_t data_len,
|
||||
data_macro_block_count_,
|
||||
nested_size_,
|
||||
nested_offset_,
|
||||
contain_uncommitted_row_);
|
||||
contain_uncommitted_row_,
|
||||
filled_tx_scn_);
|
||||
if (OB_SUCC(ret)) {
|
||||
valid_for_reading_ = key_.is_valid();
|
||||
}
|
||||
@ -1556,6 +1563,7 @@ int ObSSTable::init_sstable_meta(
|
||||
contain_uncommitted_row_ = meta_->contain_uncommitted_row();
|
||||
nested_size_ = meta_->get_macro_info().get_nested_size();
|
||||
nested_offset_ = meta_->get_macro_info().get_nested_offset();
|
||||
filled_tx_scn_ = meta_->get_filled_tx_scn();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
@ -152,6 +152,10 @@ public:
|
||||
{
|
||||
return contain_uncommitted_row_;
|
||||
}
|
||||
OB_INLINE share::SCN get_filled_tx_scn() const
|
||||
{
|
||||
return filled_tx_scn_;
|
||||
}
|
||||
bool is_empty() const
|
||||
{
|
||||
return 0 == data_macro_block_count_;
|
||||
@ -221,7 +225,7 @@ public:
|
||||
|
||||
INHERIT_TO_STRING_KV("ObITable", ObITable, KP(this), K_(addr), K_(upper_trans_version),
|
||||
K_(max_merged_trans_version), K_(data_macro_block_count), K_(nested_size),
|
||||
K_(nested_offset), K_(contain_uncommitted_row), KPC_(meta), K_(valid_for_reading));
|
||||
K_(nested_offset), K_(contain_uncommitted_row), K_(filled_tx_scn), KPC_(meta), K_(valid_for_reading));
|
||||
|
||||
private:
|
||||
int check_valid_for_reading();
|
||||
@ -280,6 +284,7 @@ protected:
|
||||
// in-memory
|
||||
bool valid_for_reading_;
|
||||
bool is_tmp_sstable_;
|
||||
share::SCN filled_tx_scn_;
|
||||
// serialized
|
||||
blocksstable::ObSSTableMeta *meta_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObSSTable);
|
||||
|
||||
@ -2146,6 +2146,8 @@ int ObTabletTableStore::check_minor_table_continue_(
|
||||
ObITable *prev_table) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSSTable *curr_sstable = nullptr;
|
||||
ObSSTable *prev_sstable = nullptr;
|
||||
if (OB_UNLIKELY(OB_ISNULL(table) || !table->is_multi_version_minor_sstable())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table must be multi version minor table", K(ret), KPC(table));
|
||||
@ -2155,6 +2157,14 @@ int ObTabletTableStore::check_minor_table_continue_(
|
||||
|| table->get_end_scn() <= prev_table->get_end_scn()) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_ERROR("table scn range not continuous or overlap", K(ret), KPC(table), KPC(prev_table));
|
||||
} else if (FALSE_IT(curr_sstable = static_cast<ObSSTable *>(table))) {
|
||||
} else if (FALSE_IT(prev_sstable = static_cast<ObSSTable *>(prev_table))) {
|
||||
} else if (table->get_key().tablet_id_.is_ls_inner_tablet() || prev_sstable->get_filled_tx_scn().is_max()) {
|
||||
// do nothing
|
||||
} else if (curr_sstable->get_filled_tx_scn() < prev_sstable->get_filled_tx_scn()) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_WARN("sstable's filled_tx_scn is out of order", K(ret), KPC(table), KP(prev_table),
|
||||
"curr_filled_tx_scn", curr_sstable->get_filled_tx_scn(), "prev_filled_tx_scn", prev_sstable->get_filled_tx_scn());
|
||||
}
|
||||
prev_table = table;
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user