Skip to content

Commit 8009387

Browse files
committed
[test](regression) Cover row counts after WAL replay
### What problem does this PR solve? Issue Number: close apache#69926 Related PR: apache#70154 Problem Summary: Add SQL-level integration coverage for the WAL reader row-count fix. Force two original async group-commit transactions to abort, then verify counts, NULLs, aggregates, filtering and field values after WAL replay. Keep the reader-level empty-projection regression cases as the precise defect reproduction. ### Release note None ### Check List (For Author) - Test: Run the new suite twice on isolated Doris 4.1.5 with scanner V2 enabled, using run-regression-test.sh to generate the output file and then compare results. Execution on master remains pending CI. - Behavior changed: No; regression coverage only. - Does this need documentation: No.
1 parent 3f6f6f3 commit 8009387

2 files changed

Lines changed: 102 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- This file is automatically generated. You should know what you did if you want to edit this
2+
-- !before_replay --
3+
0
4+
5+
-- !counts --
6+
5 4 15 120
7+
8+
-- !values --
9+
1 10
10+
2 20
11+
3 \N
12+
4 40
13+
5 50
14+
15+
-- !filtered_count --
16+
3
17+
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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.awaitility.Awaitility
19+
import static java.util.concurrent.TimeUnit.SECONDS
20+
21+
suite("test_group_commit_wal_row_count", "nonConcurrent") {
22+
sql "DROP TABLE IF EXISTS test_group_commit_wal_row_count"
23+
sql """
24+
CREATE TABLE test_group_commit_wal_row_count (
25+
k INT NOT NULL,
26+
v INT NULL
27+
) ENGINE=OLAP
28+
DUPLICATE KEY(k)
29+
DISTRIBUTED BY HASH(k) BUCKETS 1
30+
PROPERTIES (
31+
"replication_num" = "1",
32+
"group_commit_interval_ms" = "2000"
33+
)
34+
"""
35+
36+
String loadError = "LoadBlockQueue._finish_group_commit_load.load_error"
37+
String replayStop = "WalTable.replay_wals.stop"
38+
try {
39+
GetDebugPoint().enableDebugPointForAllBEs(loadError)
40+
GetDebugPoint().enableDebugPointForAllBEs(replayStop)
41+
42+
// Abort each original transaction before the next load so both WALs must be replayed.
43+
for (String data : ["1,10\n2,20\n3,\\N\n", "4,40\n5,50\n"]) {
44+
long txnId = 0
45+
streamLoad {
46+
table "test_group_commit_wal_row_count"
47+
set "column_separator", ","
48+
set "group_commit", "async_mode"
49+
unset "label"
50+
inputStream new ByteArrayInputStream(data.getBytes("UTF-8"))
51+
time 10000
52+
check { result, exception, startTime, endTime ->
53+
assertNull(exception)
54+
def response = parseJson(result)
55+
assertEquals("Success", response.Status)
56+
assertEquals(data.readLines().size(), response.NumberTotalRows as int)
57+
txnId = response.TxnId as long
58+
assertTrue(txnId > 0)
59+
}
60+
}
61+
Awaitility.await().atMost(30, SECONDS).pollInterval(1, SECONDS).until {
62+
def txn = sql_return_maparray "SHOW TRANSACTION WHERE ID = ${txnId}"
63+
return txn.size() == 1 && txn[0].TransactionStatus == "ABORTED"
64+
}
65+
}
66+
qt_before_replay "SELECT COUNT(*) FROM test_group_commit_wal_row_count"
67+
68+
// Keep the original-load failure enabled: rows can become visible only through WAL replay.
69+
GetDebugPoint().disableDebugPointForAllBEs(replayStop)
70+
Awaitility.await().atMost(90, SECONDS).pollInterval(1, SECONDS).until {
71+
def rows = sql "SELECT COUNT(*) FROM test_group_commit_wal_row_count"
72+
return rows[0][0] == 5
73+
}
74+
qt_counts """SELECT COUNT(*), COUNT(v), SUM(k), SUM(v)
75+
FROM test_group_commit_wal_row_count"""
76+
qt_values "SELECT k, v FROM test_group_commit_wal_row_count ORDER BY k"
77+
qt_filtered_count "SELECT COUNT(*) FROM test_group_commit_wal_row_count WHERE v >= 20"
78+
} finally {
79+
try {
80+
GetDebugPoint().disableDebugPointForAllBEs(replayStop)
81+
} finally {
82+
GetDebugPoint().disableDebugPointForAllBEs(loadError)
83+
}
84+
}
85+
}

0 commit comments

Comments
 (0)