|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +import org.codehaus.groovy.runtime.IOGroovyMethods |
| 19 | +import org.apache.doris.regression.util.Http |
| 20 | + |
| 21 | +suite("test_unique_key_mow_rowsets_deleted", "nonConcurrent"){ |
| 22 | + |
| 23 | + def tableName = "test_unique_key_mow_rowsets_deleted1" |
| 24 | + |
| 25 | + // 1. requested rowsets have been deleted during partial update |
| 26 | + sql """ DROP TABLE IF EXISTS ${tableName} """ |
| 27 | + sql """ CREATE TABLE ${tableName} ( |
| 28 | + `id` int(11) NOT NULL COMMENT "用户 ID", |
| 29 | + `name` varchar(65533) NOT NULL DEFAULT "yixiu" COMMENT "用户姓名", |
| 30 | + `score` int(11) NOT NULL COMMENT "用户得分", |
| 31 | + `test` int(11) NULL COMMENT "null test", |
| 32 | + `dft` int(11) DEFAULT "4321") |
| 33 | + UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS 1 |
| 34 | + PROPERTIES("replication_num" = "1", "enable_unique_key_merge_on_write" = "true"); """ |
| 35 | + |
| 36 | + sql """insert into ${tableName} values(2, "doris2", 2000, 223, 1),(1, "doris", 1000, 123, 1)""" |
| 37 | + qt_1 """ select * from ${tableName} order by id; """ |
| 38 | + try { |
| 39 | + GetDebugPoint().enableDebugPointForAllBEs("_append_block_with_partial_content.clear_specified_rowsets") |
| 40 | + sql "set enable_unique_key_partial_update=true;" |
| 41 | + sql "set enable_insert_strict = false;" |
| 42 | + sql "sync;" |
| 43 | + sql """insert into ${tableName}(id,score) values(2,400),(1,200),(4,400)""" |
| 44 | + qt_2 """ select * from ${tableName} order by id; """ |
| 45 | + sql "set enable_unique_key_partial_update=false;" |
| 46 | + sql "set enable_insert_strict = true;" |
| 47 | + sql "sync;" |
| 48 | + } finally { |
| 49 | + GetDebugPoint().disableDebugPointForAllBEs("_append_block_with_partial_content.clear_specified_rowsets") |
| 50 | + } |
| 51 | + sql "DROP TABLE IF EXISTS ${tableName};" |
| 52 | + |
| 53 | + |
| 54 | + // 2. requested rowsets have been deleted during row update |
| 55 | + tableName = "test_unique_key_mow_rowsets_deleted2" |
| 56 | + sql """ DROP TABLE IF EXISTS ${tableName} """ |
| 57 | + sql """ CREATE TABLE ${tableName} ( |
| 58 | + `id` int(11) NOT NULL COMMENT "用户 ID", |
| 59 | + `name` varchar(65533) NOT NULL DEFAULT "yixiu" COMMENT "用户姓名", |
| 60 | + `score` int(11) NOT NULL COMMENT "用户得分", |
| 61 | + `test` int(11) NULL COMMENT "null test", |
| 62 | + `dft` int(11) DEFAULT "4321") |
| 63 | + UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS 1 |
| 64 | + PROPERTIES("replication_num" = "1", "enable_unique_key_merge_on_write" = "true"); """ |
| 65 | + sql """insert into ${tableName} values(2, "doris2", 2000, 223, 1),(1, "doris", 1000, 123, 1)""" |
| 66 | + qt_3 """ select * from ${tableName} order by id; """ |
| 67 | + try { |
| 68 | + GetDebugPoint().enableDebugPointForAllBEs("BetaRowsetWriter::_generate_delete_bitmap.clear_specified_rowsets") |
| 69 | + sql """insert into ${tableName} values(2, "doris666", 9999, 888, 7),(1, "doris333", 6666, 555, 4), (3, "doris222", 1111, 987, 567);""" |
| 70 | + qt_4 """ select * from ${tableName} order by id; """ |
| 71 | + } finally { |
| 72 | + GetDebugPoint().disableDebugPointForAllBEs("BetaRowsetWriter::_generate_delete_bitmap.clear_specified_rowsets") |
| 73 | + } |
| 74 | + sql "DROP TABLE IF EXISTS ${tableName};" |
| 75 | +} |
0 commit comments