Skip to content

Commit

Permalink
[wip] fix serialize error
Browse files Browse the repository at this point in the history
  • Loading branch information
luwei16 committed Jun 27, 2024
1 parent 37d31a5 commit d95fc77
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
8 changes: 8 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,14 @@ DEFINE_Int32(download_binlog_rate_limit_kbs, "0");

DEFINE_Bool(enable_snapshot_action, "false");

DEFINE_mBool(need_add_stable_rowset, "true") ;

DEFINE_mBool(enable_checkpoint, "true");

DEFINE_mBool(clear_rs_meta, "false");

DEFINE_mInt64(tmp_tablet_id, "-1");

// clang-format off
#ifdef BE_TEST
// test s3
Expand Down
8 changes: 8 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,14 @@ DECLARE_Int32(download_binlog_rate_limit_kbs);
// whether to enable /api/snapshot api
DECLARE_Bool(enable_snapshot_action);

DECLARE_mBool(need_add_stable_rowset);

DECLARE_mBool(enable_checkpoint);

DECLARE_mBool(clear_rs_meta);

DECLARE_mInt64(tmp_tablet_id);

#ifdef BE_TEST
// test s3
DECLARE_String(test_s3_resource);
Expand Down
12 changes: 7 additions & 5 deletions be/src/olap/olap_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,13 @@ void StorageEngine::_tablet_checkpoint_callback(const std::vector<DataDir*>& dat
int64_t interval = config::generate_tablet_meta_checkpoint_tasks_interval_secs;
do {
LOG(INFO) << "begin to produce tablet meta checkpoint tasks.";
for (auto data_dir : data_dirs) {
auto st = _tablet_meta_checkpoint_thread_pool->submit_func(
[data_dir, this]() { _tablet_manager->do_tablet_meta_checkpoint(data_dir); });
if (!st.ok()) {
LOG(WARNING) << "submit tablet checkpoint tasks failed.";
if (config::enable_checkpoint) {
for (auto data_dir : data_dirs) {
auto st = _tablet_meta_checkpoint_thread_pool->submit_func(
[data_dir, this]() { _tablet_manager->do_tablet_meta_checkpoint(data_dir); });
if (!st.ok()) {
LOG(WARNING) << "submit tablet checkpoint tasks failed.";
}
}
}
interval = config::generate_tablet_meta_checkpoint_tasks_interval_secs;
Expand Down
7 changes: 6 additions & 1 deletion be/src/olap/tablet_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,12 @@ Status TabletMeta::_save_meta(DataDir* data_dir) {

Status TabletMeta::serialize(string* meta_binary) {
TabletMetaPB tablet_meta_pb;
if (config::clear_rs_meta && config::tmp_tablet_id == _tablet_id) {
_stale_rs_metas.clear();
}

to_meta_pb(&tablet_meta_pb);

bool serialize_success = tablet_meta_pb.SerializeToString(meta_binary);
if (!serialize_success) {
LOG(FATAL) << "failed to serialize meta " << full_name();
Expand Down Expand Up @@ -766,7 +771,7 @@ void TabletMeta::modify_rs_metas(const std::vector<RowsetMetaSharedPtr>& to_add,
}
}
}
if (!same_version) {
if (!same_version && config::need_add_stable_rowset) {
// put to_delete rowsets in _stale_rs_metas.
_stale_rs_metas.insert(_stale_rs_metas.end(), to_delete.begin(), to_delete.end());
}
Expand Down

0 comments on commit d95fc77

Please sign in to comment.