[fix](txn) make sub transactions visible for mow #43011
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
6544750 to
05b690b
Compare
| g_total_tablet_num << -1; | ||
| } | ||
|
|
||
| Status BaseTablet::capture_sub_txn_rs_readers( |
There was a problem hiding this comment.
warning: method 'capture_sub_txn_rs_readers' can be made const [readability-make-member-function-const]
be/src/olap/base_tablet.cpp:133:
- std::vector<std::shared_ptr<TabletTxnInfo>>* tablet_txn_infos) {
+ std::vector<std::shared_ptr<TabletTxnInfo>>* tablet_txn_infos) const {| @@ -1344,7 +1394,10 @@ Status BaseTablet::check_delete_bitmap_correctness(DeleteBitmapPtr delete_bitmap | |||
| } | |||
|
|
|||
| Status BaseTablet::update_delete_bitmap(const BaseTabletSPtr& self, TabletTxnInfo* txn_info, | |||
There was a problem hiding this comment.
warning: function 'update_delete_bitmap' has cognitive complexity of 86 (threshold 50) [readability-function-cognitive-complexity]
Status BaseTablet::update_delete_bitmap(const BaseTabletSPtr& self, TabletTxnInfo* txn_info,
^Additional context
be/src/olap/base_tablet.cpp:1410: +1
txn_info->partial_update_info && txn_info->partial_update_info->is_partial_update();
^be/src/olap/base_tablet.cpp:1411: +1, including nesting penalty of 0, nesting level increased to 1
if (is_partial_update) {
^be/src/olap/base_tablet.cpp:1412: nesting level increased to 2
transient_rs_writer = DORIS_TRY(self->create_transient_rowset_writer(
^be/src/common/status.h:708: expanded from macro 'DORIS_TRY'
({ \
^be/src/olap/base_tablet.cpp:1412: +3, including nesting penalty of 2, nesting level increased to 3
transient_rs_writer = DORIS_TRY(self->create_transient_rowset_writer(
^be/src/common/status.h:711: expanded from macro 'DORIS_TRY'
if (!res.has_value()) [[unlikely]] { \
^be/src/olap/base_tablet.cpp:1424: +1, including nesting penalty of 0, nesting level increased to 1
RETURN_IF_ERROR(std::dynamic_pointer_cast<BetaRowset>(rowset)->load_segments(&segments));
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1424: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(std::dynamic_pointer_cast<BetaRowset>(rowset)->load_segments(&segments));
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^be/src/olap/base_tablet.cpp:1430: +1, including nesting penalty of 0, nesting level increased to 1
if (self->tablet_state() == TABLET_NOTREADY) {
^be/src/olap/base_tablet.cpp:1435: +1, including nesting penalty of 0, nesting level increased to 1
RETURN_IF_ERROR(self->get_all_rs_id_unlocked(next_visible_version - 1, &cur_rowset_ids));
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1435: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(self->get_all_rs_id_unlocked(next_visible_version - 1, &cur_rowset_ids));
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^be/src/olap/base_tablet.cpp:1450: +1, including nesting penalty of 0, nesting level increased to 1
if (non_visible_rowsets != nullptr) {
^be/src/olap/base_tablet.cpp:1455: nesting level increased to 2
[](RowsetSharedPtr& lhs, RowsetSharedPtr& rhs) {
^be/src/olap/base_tablet.cpp:1460: nesting level increased to 1
[](RowsetSharedPtr& lhs, RowsetSharedPtr& rhs) {
^be/src/olap/base_tablet.cpp:1470: +1, including nesting penalty of 0, nesting level increased to 1
if (is_partial_update) {
^be/src/olap/base_tablet.cpp:1483: +2, including nesting penalty of 1, nesting level increased to 2
if (!rowsets_skip_alignment.empty()) {
^be/src/olap/base_tablet.cpp:1488: +1, including nesting penalty of 0, nesting level increased to 1
DBUG_EXECUTE_IF("BaseTablet::update_delete_bitmap.enable_spin_wait", {
^be/src/util/debug_points.h:36: expanded from macro 'DBUG_EXECUTE_IF'
if (UNLIKELY(config::enable_debug_points)) { \
^be/src/olap/base_tablet.cpp:1488: +2, including nesting penalty of 1, nesting level increased to 2
DBUG_EXECUTE_IF("BaseTablet::update_delete_bitmap.enable_spin_wait", {
^be/src/util/debug_points.h:38: expanded from macro 'DBUG_EXECUTE_IF'
if (dp) { \
^be/src/olap/base_tablet.cpp:1490: +3, including nesting penalty of 2, nesting level increased to 3
while (DebugPoints::instance()->is_enable("BaseTablet::update_delete_bitmap.block")) {
^be/src/olap/base_tablet.cpp:1493: +4, including nesting penalty of 3, nesting level increased to 4
if (block_dp) {
^be/src/olap/base_tablet.cpp:1495: +5, including nesting penalty of 4, nesting level increased to 5
if (wait_token != token) {
^be/src/olap/base_tablet.cpp:1503: +1, including nesting penalty of 0, nesting level increased to 1
if (!rowsets_skip_alignment.empty()) {
^be/src/olap/base_tablet.cpp:1506: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(calc_delete_bitmap(self, rowset, segments, rowsets_skip_alignment,
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1506: +3, including nesting penalty of 2, nesting level increased to 3
RETURN_IF_ERROR(calc_delete_bitmap(self, rowset, segments, rowsets_skip_alignment,
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^be/src/olap/base_tablet.cpp:1509: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(token->wait());
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1509: +3, including nesting penalty of 2, nesting level increased to 3
RETURN_IF_ERROR(token->wait());
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^be/src/olap/base_tablet.cpp:1514: +1, including nesting penalty of 0, nesting level increased to 1
if (segments.size() <= 1) {
^be/src/olap/base_tablet.cpp:1515: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(calc_delete_bitmap(self, rowset, segments, specified_rowsets, delete_bitmap,
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1515: +3, including nesting penalty of 2, nesting level increased to 3
RETURN_IF_ERROR(calc_delete_bitmap(self, rowset, segments, specified_rowsets, delete_bitmap,
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^be/src/olap/base_tablet.cpp:1519: +1, nesting level increased to 1
} else {
^be/src/olap/base_tablet.cpp:1521: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(calc_delete_bitmap(self, rowset, segments, specified_rowsets, delete_bitmap,
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1521: +3, including nesting penalty of 2, nesting level increased to 3
RETURN_IF_ERROR(calc_delete_bitmap(self, rowset, segments, specified_rowsets, delete_bitmap,
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^be/src/olap/base_tablet.cpp:1524: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(token->wait());
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1524: +3, including nesting penalty of 2, nesting level increased to 3
RETURN_IF_ERROR(token->wait());
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^be/src/olap/base_tablet.cpp:1532: +1, including nesting penalty of 0, nesting level increased to 1
if (config::enable_merge_on_write_correctness_check && rowset->num_rows() != 0) {
^be/src/olap/base_tablet.cpp:1532: +1
if (config::enable_merge_on_write_correctness_check && rowset->num_rows() != 0) {
^be/src/olap/base_tablet.cpp:1537: +2, including nesting penalty of 1, nesting level increased to 2
if (!st.ok()) {
^be/src/olap/base_tablet.cpp:1542: +1, including nesting penalty of 0, nesting level increased to 1
if (transient_rs_writer) {
^be/src/olap/base_tablet.cpp:1544: +2, including nesting penalty of 1, nesting level increased to 2
DBUG_EXECUTE_IF("Tablet.update_delete_bitmap.partial_update_write_rowset_fail", {
^be/src/util/debug_points.h:36: expanded from macro 'DBUG_EXECUTE_IF'
if (UNLIKELY(config::enable_debug_points)) { \
^be/src/olap/base_tablet.cpp:1544: +3, including nesting penalty of 2, nesting level increased to 3
DBUG_EXECUTE_IF("Tablet.update_delete_bitmap.partial_update_write_rowset_fail", {
^be/src/util/debug_points.h:38: expanded from macro 'DBUG_EXECUTE_IF'
if (dp) { \
^be/src/olap/base_tablet.cpp:1545: +4, including nesting penalty of 3, nesting level increased to 4
if (rand() % 100 < (100 * dp->param("percent", 0.5))) {
^be/src/olap/base_tablet.cpp:1553: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(transient_rs_writer->flush());
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1553: +3, including nesting penalty of 2, nesting level increased to 3
RETURN_IF_ERROR(transient_rs_writer->flush());
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^be/src/olap/base_tablet.cpp:1555: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(transient_rs_writer->build(transient_rowset));
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1555: +3, including nesting penalty of 2, nesting level increased to 3
RETURN_IF_ERROR(transient_rs_writer->build(transient_rowset));
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^be/src/olap/base_tablet.cpp:1572: nesting level increased to 1
[](size_t sum, const segment_v2::SegmentSharedPtr& s) { return sum += s->num_rows(); });
^be/src/olap/base_tablet.cpp:1574: +1, including nesting penalty of 0, nesting level increased to 1
RETURN_IF_ERROR(self->save_delete_bitmap(txn_info, txn_id, delete_bitmap,
^be/src/common/status.h:629: expanded from macro 'RETURN_IF_ERROR'
do { \
^be/src/olap/base_tablet.cpp:1574: +2, including nesting penalty of 1, nesting level increased to 2
RETURN_IF_ERROR(self->save_delete_bitmap(txn_info, txn_id, delete_bitmap,
^be/src/common/status.h:631: expanded from macro 'RETURN_IF_ERROR'
if (UNLIKELY(!_status_.ok())) { \
^| Status BaseTablet::txn_load_update_delete_bitmap( | ||
| const BaseTabletSPtr& self, TabletTxnInfo* txn_info, int64_t txn_id, int64_t txn_expiration, | ||
| const std::vector<RowsetSharedPtr>& visible_rowsets, | ||
| const std::vector<RowsetSharedPtr>& non_visible_rowsets, |
There was a problem hiding this comment.
warning: function 'txn_load_update_delete_bitmap' exceeds recommended size/complexity thresholds [readability-function-size]
Status BaseTablet::txn_load_update_delete_bitmap(
^Additional context
be/src/olap/base_tablet.cpp:1632: 154 lines including whitespace and comments (threshold 80)
Status BaseTablet::txn_load_update_delete_bitmap(
^| return true; | ||
| } | ||
|
|
||
| void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller, |
There was a problem hiding this comment.
warning: function 'get_tmp_rowset' exceeds recommended size/complexity thresholds [readability-function-size]
void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,
^Additional context
cloud/src/meta-service/meta_service.cpp:1412: 97 lines including whitespace and comments (threshold 80)
void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,
^| return; | ||
| } | ||
| // set tablet schema | ||
| if (rowset_meta->has_tablet_schema()) continue; |
There was a problem hiding this comment.
warning: statement should be inside braces [readability-braces-around-statements]
| if (rowset_meta->has_tablet_schema()) continue; | |
| if (rowset_meta->has_tablet_schema()) { continue; | |
| } |
| return Status::OK(); | ||
| } | ||
|
|
||
| Status BaseTablet::txn_load_update_delete_bitmap( |
There was a problem hiding this comment.
warning: function 'txn_load_update_delete_bitmap' exceeds recommended size/complexity thresholds [readability-function-size]
Status BaseTablet::txn_load_update_delete_bitmap(
^Additional context
be/src/olap/base_tablet.cpp:1629: 153 lines including whitespace and comments (threshold 80)
Status BaseTablet::txn_load_update_delete_bitmap(
^|
run buildall |
TPC-H: Total hot run time: 41639 ms |
TPC-DS: Total hot run time: 195466 ms |
ClickBench: Total hot run time: 33.15 s |
this pr is based on #41362 and #41932
The idea is when query rowsets of sub txns, calculate its delete bitmap