Skip to content

Commit 204685d

Browse files
obdevfootka
authored andcommitted
fix: preserve fork_info_ in ObTabletMeta migration-update path to prevent standby query hang on fork dst tablet
Co-authored-by: footka <672528926@qq.com>
1 parent 674d567 commit 204685d

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/storage/tablet/ob_tablet.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5714,6 +5714,7 @@ int ObTablet::build_migration_tablet_param(
57145714
mig_tablet_param.is_empty_shell_ = is_empty_shell();
57155715
mig_tablet_param.split_info_ = tablet_meta_.split_info_;
57165716
mig_tablet_param.has_truncate_info_ = tablet_meta_.has_truncate_info_;
5717+
mig_tablet_param.fork_info_ = tablet_meta_.fork_info_;
57175718

57185719
if (OB_FAIL(ret)) {
57195720
} else if (OB_FAIL(build_migration_tablet_param_storage_schema(mig_tablet_param))) {

src/storage/tablet/ob_tablet_meta.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ int ObTabletMeta::init(
450450
extra_medium_info_ = param.extra_medium_info_;
451451
split_info_ = param.split_info_;
452452
has_truncate_info_ = param.has_truncate_info_;
453+
fork_info_ = param.fork_info_;
453454
if (param.version_ < ObMigrationTabletParam::PARAM_VERSION_V3) {
454455
int64_t tmp_pos = 0;
455456
const ObString &user_data = param.mds_data_.tablet_status_committed_kv_.v_.user_data_;
@@ -624,6 +625,7 @@ int ObTabletMeta::init(
624625
has_next_tablet_ = old_tablet_meta.has_next_tablet_;
625626
micro_index_clustered_ = old_tablet_meta.micro_index_clustered_;
626627
split_info_ = OB_ISNULL(tablet_meta) ? old_tablet_meta.split_info_ : tablet_meta->split_info_; // migration sstables replaces split status.
628+
fork_info_ = OB_ISNULL(tablet_meta) ? old_tablet_meta.fork_info_ : tablet_meta->fork_info_;
627629
if (old_tablet_meta.has_truncate_info_ || (OB_NOT_NULL(tablet_meta) && tablet_meta->has_truncate_info_)) {
628630
has_truncate_info_ = true;
629631
}
@@ -1379,6 +1381,8 @@ int ObMigrationTabletParam::serialize(char *buf, const int64_t len, int64_t &pos
13791381
LOG_WARN("failed to serialize split info", K(ret), K(len), K(new_pos), K_(split_info));
13801382
} else if (PARAM_VERSION_V3 <= version_ && new_pos - pos < length && OB_FAIL(serialization::encode_bool(buf, len, new_pos, has_truncate_info_))) {
13811383
LOG_WARN("failed to serialize has_truncate_info", K(ret), K(len), K(new_pos), K_(has_truncate_info));
1384+
} else if (PARAM_VERSION_V3 <= version_ && new_pos - pos < length && OB_FAIL(fork_info_.serialize(buf, len, new_pos))) {
1385+
LOG_WARN("failed to serialize fork info", K(ret), K(len), K(new_pos), K_(fork_info));
13821386
} else if (OB_UNLIKELY(length != new_pos - pos)) {
13831387
ret = OB_ERR_UNEXPECTED;
13841388
LOG_WARN("length doesn't match standard length", K(ret), K(new_pos), K(pos), K(length));
@@ -1476,6 +1480,8 @@ int ObMigrationTabletParam::deserialize_v2_v3(const char *buf, const int64_t len
14761480
LOG_WARN("failed to deserialize split info", K(ret), K(len));
14771481
} else if (PARAM_VERSION_V3 <= version_ && new_pos - pos < length && OB_FAIL(serialization::decode_bool(buf, len, new_pos, &has_truncate_info_))) {
14781482
LOG_WARN("failed to deserialize has_truncate_info", K(ret), K(len));
1483+
} else if (PARAM_VERSION_V3 <= version_ && new_pos - pos < length && OB_FAIL(fork_info_.deserialize(buf, len, new_pos))) {
1484+
LOG_WARN("failed to deserialize fork info", K(ret), K(len));
14791485
} else if (OB_UNLIKELY(length != new_pos - pos)) {
14801486
ret = OB_ERR_UNEXPECTED;
14811487
LOG_WARN("tablet's length doesn't match standard length", K(ret), K(new_pos), K(pos), K(length), KPC(this));
@@ -1679,6 +1685,7 @@ int64_t ObMigrationTabletParam::get_serialize_size() const
16791685
size += serialization::encoded_length_bool(is_storage_schema_cs_replica_);
16801686
size += split_info_.get_serialize_size();
16811687
size += serialization::encoded_length_bool(has_truncate_info_);
1688+
size += fork_info_.get_serialize_size();
16821689
}
16831690
return size;
16841691
}
@@ -1723,6 +1730,7 @@ void ObMigrationTabletParam::reset()
17231730
is_storage_schema_cs_replica_ = false;
17241731
split_info_.reset();
17251732
has_truncate_info_ = false;
1733+
fork_info_.reset();
17261734
allocator_.reset();
17271735
}
17281736

@@ -1768,6 +1776,7 @@ int ObMigrationTabletParam::assign(const ObMigrationTabletParam &param)
17681776
is_storage_schema_cs_replica_ = param.is_storage_schema_cs_replica_;
17691777
split_info_ = param.split_info_;
17701778
has_truncate_info_ = param.has_truncate_info_;
1779+
fork_info_ = param.fork_info_;
17711780
if (OB_FAIL(mds_data_.assign(param.mds_data_, allocator_))) {
17721781
LOG_WARN("failed to assign mds data", K(ret), K(param));
17731782
} else if (OB_FAIL(last_persisted_committed_tablet_status_.assign(

src/storage/tablet/ob_tablet_meta.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ struct ObMigrationTabletParam final
334334
K_(ddl_replay_status),
335335
K_(is_storage_schema_cs_replica),
336336
K_(split_info),
337-
K_(has_truncate_info));
337+
K_(has_truncate_info),
338+
K_(fork_info));
338339
private:
339340
int deserialize_v2_v3(const char *buf, const int64_t len, int64_t &pos);
340341
int deserialize_v1(const char *buf, const int64_t len, int64_t &pos);
@@ -391,6 +392,7 @@ struct ObMigrationTabletParam final
391392
// [since 4.3.5 bp2] be True after first major with truncate info
392393
// will never be false even after truncate info recycled
393394
bool has_truncate_info_;
395+
share::ObForkTabletInfo fork_info_;
394396

395397
// Add new serialization member before this line, below members won't serialize
396398
common::ObArenaAllocator allocator_; // for storage schema

0 commit comments

Comments
 (0)