diff --git a/pkg/sink/sqlmodel/row_change_test.go b/pkg/sink/sqlmodel/row_change_test.go index 34548481a7..cedeb816a4 100644 --- a/pkg/sink/sqlmodel/row_change_test.go +++ b/pkg/sink/sqlmodel/row_change_test.go @@ -308,9 +308,9 @@ func (s *dpanicSuite) TestGenUpdate() { func (s *dpanicSuite) TestExpressionIndex() { source := &common.TableName{Schema: "db", Table: "tb1"} sql := `CREATE TABLE tb1 ( - id INT PRIMARY KEY, - j JSON, - UNIQUE KEY j_index ((cast(json_extract(j,'$[*]') as signed array)), id) + id INT PRIMARY KEY, + j JSON, + UNIQUE KEY j_index ((cast(json_extract(j,'$[*]') as signed array)), id) )` ti := mockTableInfo(s.T(), sql) change := NewRowChange(source, nil, nil, []interface{}{1, `[1,2,3]`, nil}, ti, nil, nil) diff --git a/tests/integration_tests/_utils/start_tidb_cluster_nextgen b/tests/integration_tests/_utils/start_tidb_cluster_nextgen index 0a13ae885b..1f45ee8c9a 100755 --- a/tests/integration_tests/_utils/start_tidb_cluster_nextgen +++ b/tests/integration_tests/_utils/start_tidb_cluster_nextgen @@ -13,8 +13,10 @@ TEST_DATA_DIR="$CASE_DIR/$TEST_OUT_DATA_DIR" echo "TEST_DATA_DIR: $TEST_DATA_DIR" -# Random generate the sockets config. -# Make sure we dont use the same sock. +# Random generate the `socket` config for TiDB. +# TiDB parses `socket = ...` as a root-level key. Our generated config ends with +# `[instance]`, so appending `socket = ...` at the end would become `instance.socket`, +# which is rejected by newer TiDB versions (and makes TiDB fail to start). randomGenSocketsConf() { config_file="$1" random_str=$(date '+%s%N') @@ -22,7 +24,13 @@ randomGenSocketsConf() { random_str=$(cat /dev/random | LC_ALL=C tr -dc "a-zA-Z0-9" | head -c 10) fi - echo "socket = \"/tmp/tidb-$random_str.sock\"" >>"$config_file" + # Prepend the root-level `socket` and drop any existing `socket = ...` lines + # (old scripts appended it under `[instance]`, which becomes `instance.socket`). + { + echo "socket = \"/tmp/tidb-$random_str.sock\"" + sed '/^[[:space:]]*socket[[:space:]]*=/d' "$config_file" + } >"$config_file.tmp" + mv "$config_file.tmp" "$config_file" } check_bin() { @@ -353,6 +361,18 @@ tikv-worker --addr "$DOWN_TIKV_WORKER_HOST:$DOWN_TIKV_WORKER_PORT" \ check_port_available "$UP_TIKV_WORKER_HOST" "$UP_TIKV_WORKER_PORT" "Upstream TiKV-Worker is not ready yet" check_port_available "$DOWN_TIKV_WORKER_HOST" "$DOWN_TIKV_WORKER_PORT" "Downstream TiKV-Worker is not ready yet" +####################start TiDB#################### +# TODO: replace this fixed delay with an explicit keyspace readiness check. +# PD health only guarantees the service is up. In next-gen bootstrap we also +# rely on PD finishing keyspace pre-allocation before the SYSTEM TiDB starts. +# Giving PD a short quiet window here reduces flaky startup failures in CI. +echo "Waiting for next-gen keyspace pre-allocation to settle..." +sleep 30 + +# NOTE: TiDB config keys are section-sensitive. Keep `socket` and +# `max-server-connections` at root level, and keep tuning knobs like +# `run-auto-analyze` / `server-memory-quota` under `[performance]`. Otherwise +# TiDB will report "invalid configuration options" and silently ignore them. touch "$OUT_DIR/upstream-tidb-system.toml" if [ -f "$tidb_config" ]; then cat "$tidb_config" >>"$OUT_DIR/upstream-tidb-system.toml" @@ -362,9 +382,7 @@ cat >>"$OUT_DIR/upstream-tidb-system.toml" <>"$OUT_DIR/upstream-tidb-$KEYSPACE_NAME.toml" <>"$OUT_DIR/downstream-tidb-system.toml" <>"$OUT_DIR/downstream-tidb-$KEYSPACE_NAME.toml" <"$OUT_DIR/tidb-system-config-tls.toml" <