Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
bobhan1 committed Jul 29, 2024
1 parent 94c668f commit fcc24a4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
6 changes: 5 additions & 1 deletion be/src/olap/base_tablet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1250,9 +1250,13 @@ Status BaseTablet::update_delete_bitmap(const BaseTabletSPtr& self, TabletTxnInf
// the delete bitmap for that rowset.
std::vector<RowsetSharedPtr> rowsets_skip_alignment;
if (is_partial_update) {
int64_t max_version_in_flush_phase =
txn_info->partial_update_info->max_version_in_flush_phase;
DCHECK(max_version_in_flush_phase != -1);
std::vector<RowsetSharedPtr> remained_rowsets;
for (const auto& rowset : specified_rowsets) {
if (rowset->produced_by_compaction()) {
if (rowset->end_version() < max_version_in_flush_phase &&
rowset->produced_by_compaction()) {
rowsets_skip_alignment.emplace_back(rowset);
} else {
remained_rowsets.emplace_back(rowset);
Expand Down
5 changes: 3 additions & 2 deletions be/src/olap/partial_update_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ struct PartialUpdateInfo {
void init(const TabletSchema& tablet_schema, bool partial_update,
const std::set<string>& partial_update_cols, bool is_strict_mode,
int64_t timestamp_ms, const std::string& timezone,
const std::string& auto_increment_column) {
const std::string& auto_increment_column, int64_t cur_max_version = -1) {
is_partial_update = partial_update;
partial_update_input_columns = partial_update_cols;

max_version_in_flush_phase = cur_max_version;
this->timestamp_ms = timestamp_ms;
this->timezone = timezone;
missing_cids.clear();
Expand Down Expand Up @@ -91,6 +91,7 @@ struct PartialUpdateInfo {

public:
bool is_partial_update {false};
int64_t max_version_in_flush_phase {-1};
std::set<std::string> partial_update_input_columns;
std::vector<uint32_t> missing_cids;
std::vector<uint32_t> update_cids;
Expand Down
13 changes: 8 additions & 5 deletions be/src/olap/rowset_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "io/fs/file_writer.h" // IWYU pragma: keep
#include "olap/calc_delete_bitmap_executor.h"
#include "olap/olap_define.h"
#include "olap/partial_update_info.h"
#include "olap/rowset/beta_rowset.h"
#include "olap/rowset/beta_rowset_writer.h"
#include "olap/rowset/pending_rowset_helper.h"
Expand Down Expand Up @@ -123,7 +124,7 @@ void RowsetBuilder::_garbage_collection() {

Status BaseRowsetBuilder::init_mow_context(std::shared_ptr<MowContext>& mow_context) {
std::lock_guard<std::shared_mutex> lck(tablet()->get_header_lock());
int64_t cur_max_version = tablet()->max_version_unlocked();
_max_version_in_flush_phase = tablet()->max_version_unlocked();
std::vector<RowsetSharedPtr> rowset_ptrs;
// tablet is under alter process. The delete bitmap will be calculated after conversion.
if (tablet()->tablet_state() == TABLET_NOTREADY) {
Expand All @@ -135,12 +136,13 @@ Status BaseRowsetBuilder::init_mow_context(std::shared_ptr<MowContext>& mow_cont
}
_rowset_ids.clear();
} else {
RETURN_IF_ERROR(tablet()->get_all_rs_id_unlocked(cur_max_version, &_rowset_ids));
RETURN_IF_ERROR(
tablet()->get_all_rs_id_unlocked(_max_version_in_flush_phase, &_rowset_ids));
rowset_ptrs = tablet()->get_rowset_by_ids(&_rowset_ids);
}
_delete_bitmap = std::make_shared<DeleteBitmap>(tablet()->tablet_id());
mow_context = std::make_shared<MowContext>(cur_max_version, _req.txn_id, _rowset_ids,
rowset_ptrs, _delete_bitmap);
mow_context = std::make_shared<MowContext>(_max_version_in_flush_phase, _req.txn_id,
_rowset_ids, rowset_ptrs, _delete_bitmap);
return Status::OK();
}

Expand Down Expand Up @@ -408,7 +410,8 @@ void BaseRowsetBuilder::_build_current_tablet_schema(int64_t index_id,
table_schema_param->partial_update_input_columns(),
table_schema_param->is_strict_mode(),
table_schema_param->timestamp_ms(), table_schema_param->timezone(),
table_schema_param->auto_increment_coulumn());
table_schema_param->auto_increment_coulumn(),
_max_version_in_flush_phase);
}

} // namespace doris
1 change: 1 addition & 0 deletions be/src/olap/rowset_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class BaseRowsetBuilder {
std::unique_ptr<CalcDeleteBitmapToken> _calc_delete_bitmap_token;
// current rowset_ids, used to do diff in publish_version
RowsetIdUnorderedSet _rowset_ids;
int64_t _max_version_in_flush_phase {-1};

std::shared_ptr<PartialUpdateInfo> _partial_update_info;

Expand Down

0 comments on commit fcc24a4

Please sign in to comment.