Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobhan1 committed Feb 24, 2025
1 parent ea2ad20 commit 4113ad7
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 3 deletions.
2 changes: 1 addition & 1 deletion be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ DEFINE_mBool(enable_check_tablet_delete_bitmap_score, "true");

// whether to prune rows with delete sign = 1 in base compaction
// ATTN: this config is only for test
DEFINE_mBool(prune_delete_sign_when_base_compaction, "false");
DEFINE_mBool(enable_prune_delete_sign_when_base_compaction, "true");

// clang-format off
#ifdef BE_TEST
Expand Down
2 changes: 1 addition & 1 deletion be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ DECLARE_mBool(enable_check_tablet_delete_bitmap_score);

// whether to prune rows with delete sign = 1 in base compaction
// ATTN: this config is only for test
DECLARE_mBool(prune_delete_sign_when_base_compaction);
DECLARE_mBool(enable_prune_delete_sign_when_base_compaction);

#ifdef BE_TEST
// test s3
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/tablet_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ Status TabletReader::_init_delete_condition(const ReaderParams& read_params) {
// If delete design is applied on cumu compaction, it will lose effect when doing base compaction.
// `_delete_sign_available` indicates the condition where we could apply delete signs to data.
_delete_sign_available = ((read_params.reader_type == ReaderType::READER_BASE_COMPACTION &&
config::prune_delete_sign_when_base_compaction) ||
config::enable_prune_delete_sign_when_base_compaction) ||
read_params.reader_type == ReaderType::READER_COLD_DATA_COMPACTION ||
read_params.reader_type == ReaderType::READER_CHECKSUM);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import org.junit.Assert
import java.util.concurrent.TimeUnit
import org.awaitility.Awaitility

// test cases to ensure that inject points for mow correctness work as expected
suite("test_config_prune_delete_sign", "nonConcurrent") {

def inspectRows = { sqlStr ->
sql "set skip_delete_sign=true;"
sql "set skip_delete_bitmap=true;"
sql "sync"
qt_inspect sqlStr
sql "set skip_delete_sign=false;"
sql "set skip_delete_bitmap=false;"
sql "sync"
}

def custoBeConfig = [
enable_prune_delete_sign_when_base_compaction : true
]

setBeConfigTemporary(custoBeConfig) {
def table1 = "test_config_prune_delete_sign"
sql "DROP TABLE IF EXISTS ${table1} FORCE;"
sql """ CREATE TABLE IF NOT EXISTS ${table1} (
`k1` int NOT NULL,
`c1` int,
`c2` int
)UNIQUE KEY(k1)
DISTRIBUTED BY HASH(k1) BUCKETS 1
PROPERTIES (
"enable_mow_light_delete" = "false",
"enable_unique_key_merge_on_write" = "true",
"disable_auto_compaction" = "true",
"replication_num" = "1"); """

(1..20).each {
sql "insert into ${table1} values($it,$it,$it);"
}
sql "sync;"
qt_sql "select count() from ${table1};"

sql "delete from ${table1} where k<=10;"

qt_sql "select count() from ${table1};"

sql "set skip_delete_sign=true;"
sql "set skip_delete_bitmap=true;"
sql "sync"
qt_sql "select count() from ${table1} where __DORIS_DELETE_SIGN__=1;"
sql "set skip_delete_sign=false;"
sql "set skip_delete_bitmap=false;"
sql "sync"

trigger_and_wait_compaction(table1, "base")
qt_sql "select count() from ${table1};"

sql "set skip_delete_sign=true;"
sql "set skip_delete_bitmap=true;"
sql "sync"
qt_sql "select count() from ${table1} where __DORIS_DELETE_SIGN__=1;"
sql "set skip_delete_sign=false;"
sql "set skip_delete_bitmap=false;"
sql "sync"
}
}

0 comments on commit 4113ad7

Please sign in to comment.