Skip to content

Commit 7b27c3a

Browse files
authored
fix: ensure result correctness when enable pruning cache (#17524)
* reproduce * reproduce * reproduce * reproduce * fix: ensure result correctness when enable pruning cache
1 parent aeaf443 commit 7b27c3a

File tree

5 files changed

+65
-3
lines changed

5 files changed

+65
-3
lines changed

scripts/ci/ci-run-stateful-tests-cluster-minio.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export STORAGE_ALLOW_INSECURE=true
2020

2121
echo "Install dependence"
2222
python3 -m pip install --quiet mysql-connector-python requests
23+
sudo apt-get update -yq
24+
sudo apt-get install -yq lsof
2325

2426
echo "calling test suite"
2527
echo "Starting Cluster databend-query"

scripts/ci/ci-run-stateful-tests-standalone-minio.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export STORAGE_ALLOW_INSECURE=true
2020

2121
echo "Install dependence"
2222
python3 -m pip install --quiet mysql-connector-python requests
23+
sudo apt-get update -yq
24+
sudo apt-get install -yq lsof
2325

2426
echo "calling test suite"
2527
echo "Starting standalone DatabendQuery(debug)"

src/query/storages/fuse/src/operations/read_partitions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl FuseTable {
170170
plan: &DataSourcePlan,
171171
source_pipeline: &mut Pipeline,
172172
) -> Result<Option<Pipeline>> {
173-
let segments_location = plan.statistics.snapshot.clone();
173+
let snapshot = plan.statistics.snapshot.clone();
174174
let table_schema = self.schema_with_stream();
175175
let dal = self.operator.clone();
176176
let mut lazy_init_segments = Vec::with_capacity(plan.parts.len());
@@ -180,7 +180,7 @@ impl FuseTable {
180180
lazy_init_segments.push(SegmentLocation {
181181
segment_idx: lazy_part_info.segment_index,
182182
location: lazy_part_info.segment_location.clone(),
183-
snapshot_loc: segments_location.clone(),
183+
snapshot_loc: snapshot.clone(),
184184
});
185185
}
186186
}
@@ -202,7 +202,7 @@ impl FuseTable {
202202
.map(|push_downs| {
203203
format!(
204204
"{:x}",
205-
Sha256::digest(format!("{:?}_{:?}", segments_location, push_downs))
205+
Sha256::digest(format!("{:?}_{:?}", lazy_init_segments, push_downs))
206206
)
207207
});
208208

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
1
2+
1
3+
1
4+
1
5+
test_text1
6+
test_text2
7+
test_text3
8+
test_text4
9+
2
10+
test_text1
11+
test_text2
12+
test_text3
13+
test_text4
14+
3
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
4+
. "$CURDIR"/../../../shell_env.sh
5+
6+
# Skip in standalone mode
7+
port_check=$(sudo lsof -i :9093)
8+
if [ -z "$port_check" ]; then
9+
echo -e "1\n1\n1\n1\ntest_text1\ntest_text2\ntest_text3\ntest_text4\n2\ntest_text1\ntest_text2\ntest_text3\ntest_text4\n3"
10+
exit 0
11+
fi
12+
13+
echo "drop table if exists table_test_02_0010;" | $BENDSQL_CLIENT_CONNECT
14+
15+
echo "create table table_test_02_0010(TEXT String);" | $BENDSQL_CLIENT_CONNECT
16+
17+
18+
table_inserts=(
19+
"INSERT INTO table_test_02_0010 VALUES('test_text1');"
20+
"INSERT INTO table_test_02_0010 VALUES('test_text2');"
21+
"INSERT INTO table_test_02_0010 VALUES('test_text3');"
22+
"INSERT INTO table_test_02_0010 VALUES('test_text4');"
23+
)
24+
25+
for i in "${table_inserts[@]}"; do
26+
echo "$i" | $BENDSQL_CLIENT_CONNECT
27+
done
28+
29+
30+
echo "select * from table_test_02_0010 order by text;" | $BENDSQL_CLIENT_CONNECT
31+
32+
# kill a node
33+
sudo lsof -i :9093 -t | xargs -r sudo kill -9
34+
35+
echo "select count(*) from system.clusters;" | $BENDSQL_CLIENT_CONNECT
36+
37+
echo "select * from table_test_02_0010 order by text;" | $BENDSQL_CLIENT_CONNECT
38+
39+
# restart the node
40+
ROOTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../../../../ && pwd)"
41+
env "RUST_BACKTRACE=1" nohup "$ROOTDIR"/target/${BUILD_PROFILE}/databend-query -c "$ROOTDIR"/scripts/ci/deploy/config/databend-query-node-3.toml --internal-enable-sandbox-tenant > "$ROOTDIR"/.databend/query-3.out 2>&1 &
42+
python3 "$ROOTDIR"/scripts/ci/wait_tcp.py --timeout 30 --port 9093 > /dev/null 2>&1
43+
44+
echo "select count(*) from system.clusters;" | $BENDSQL_CLIENT_CONNECT

0 commit comments

Comments
 (0)