Skip to content

Commit 90198d7

Browse files
committed
fix ci failure
Signed-off-by: BornChanger <dawn_catcher@126.com>
1 parent c044347 commit 90198d7

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ cdc-junit-report.xml
1818
# temp files
1919
*.tmp
2020
metastore_db/
21+
22+
.gocache/
23+
.gopath/

tests/integration_tests/iceberg_append_basic/run.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ function prepare() {
3737

3838
WAREHOUSE_DIR="$WORK_DIR/iceberg_warehouse"
3939
SINK_URI="iceberg://?warehouse=file://$WAREHOUSE_DIR&catalog=hadoop&namespace=ns&mode=append&commit-interval=1s&enable-checkpoint-table=true&enable-global-checkpoint-table=true&partitioning=days(_tidb_commit_time)"
40-
cdc_cli_changefeed create --start-ts=$start_ts --sink-uri="$SINK_URI"
40+
changefeed_id=$(cdc_cli_changefeed create --start-ts=$start_ts --sink-uri="$SINK_URI" | grep '^ID:' | head -n1 | awk '{print $2}')
41+
wait_changefeed_table_assigned "$changefeed_id" "test" "iceberg_append_basic"
4142
}
4243

4344
function wait_file_exists() {
@@ -55,6 +56,34 @@ function wait_file_exists() {
5556
return 1
5657
}
5758

59+
function wait_changefeed_table_assigned() {
60+
changefeed_id=$1
61+
db_name=$2
62+
table_name=$3
63+
64+
if [ "${TICDC_NEWARCH:-}" != "true" ]; then
65+
return 0
66+
fi
67+
68+
table_id=$(get_table_id "$db_name" "$table_name")
69+
echo "wait table ${db_name}.${table_name} (id=${table_id}) assigned to changefeed ${changefeed_id}"
70+
71+
i=0
72+
while [ $i -lt 60 ]; do
73+
if curl -s "http://127.0.0.1:8300/api/v2/changefeeds/${changefeed_id}/tables?keyspace=${KEYSPACE_NAME}" \
74+
| jq -e --argjson tid "$table_id" \
75+
'def items: (if type=="array" then . else .items // [] end); items[]?.table_ids[]? | select(. == $tid)' >/dev/null; then
76+
return 0
77+
fi
78+
sleep 2
79+
((i++))
80+
done
81+
82+
echo "table ${db_name}.${table_name} not assigned to changefeed ${changefeed_id} after $((i * 2))s"
83+
curl -s "http://127.0.0.1:8300/api/v2/changefeeds/${changefeed_id}/tables?keyspace=${KEYSPACE_NAME}" | jq . || true
84+
return 1
85+
}
86+
5887
function iceberg_check_append_basic() {
5988
do_retry 5 2 run_sql "INSERT INTO test.iceberg_append_basic(id, val) VALUES (1, 1);"
6089
do_retry 5 2 run_sql "INSERT INTO test.iceberg_append_basic(id, val) VALUES (2, 2);"

tests/integration_tests/iceberg_upsert_basic/run.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ function prepare() {
3737

3838
WAREHOUSE_DIR="$WORK_DIR/iceberg_warehouse"
3939
SINK_URI="iceberg://?warehouse=file://$WAREHOUSE_DIR&catalog=hadoop&namespace=ns&mode=upsert&commit-interval=1s&enable-checkpoint-table=true&partitioning=none"
40-
cdc_cli_changefeed create --start-ts=$start_ts --sink-uri="$SINK_URI"
40+
changefeed_id=$(cdc_cli_changefeed create --start-ts=$start_ts --sink-uri="$SINK_URI" | grep '^ID:' | head -n1 | awk '{print $2}')
41+
wait_changefeed_table_assigned "$changefeed_id" "test" "iceberg_upsert_basic"
4142
}
4243

4344
function wait_file_exists() {
@@ -55,6 +56,34 @@ function wait_file_exists() {
5556
return 1
5657
}
5758

59+
function wait_changefeed_table_assigned() {
60+
changefeed_id=$1
61+
db_name=$2
62+
table_name=$3
63+
64+
if [ "${TICDC_NEWARCH:-}" != "true" ]; then
65+
return 0
66+
fi
67+
68+
table_id=$(get_table_id "$db_name" "$table_name")
69+
echo "wait table ${db_name}.${table_name} (id=${table_id}) assigned to changefeed ${changefeed_id}"
70+
71+
i=0
72+
while [ $i -lt 60 ]; do
73+
if curl -s "http://127.0.0.1:8300/api/v2/changefeeds/${changefeed_id}/tables?keyspace=${KEYSPACE_NAME}" \
74+
| jq -e --argjson tid "$table_id" \
75+
'def items: (if type=="array" then . else .items // [] end); items[]?.table_ids[]? | select(. == $tid)' >/dev/null; then
76+
return 0
77+
fi
78+
sleep 2
79+
((i++))
80+
done
81+
82+
echo "table ${db_name}.${table_name} not assigned to changefeed ${changefeed_id} after $((i * 2))s"
83+
curl -s "http://127.0.0.1:8300/api/v2/changefeeds/${changefeed_id}/tables?keyspace=${KEYSPACE_NAME}" | jq . || true
84+
return 1
85+
}
86+
5887
function iceberg_check_upsert_basic() {
5988
do_retry 5 2 run_sql "INSERT INTO test.iceberg_upsert_basic(id, val) VALUES (1, 1);"
6089
do_retry 5 2 run_sql "INSERT INTO test.iceberg_upsert_basic(id, val) VALUES (2, 2);"

0 commit comments

Comments
 (0)