Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions tests/integration_tests/_utils/start_tidb_cluster_nextgen
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ if [ -z "$OUT_DIR" ]; then
exit 1
fi

echo "Checking TiKV version information..."
tikvVersionInfo=$(tikv-server -V 2>&1)
printf '%s\n' "$tikvVersionInfo"
tikvGitCommitBranch=$(printf '%s\n' "$tikvVersionInfo" | sed -nE 's/^Git Commit Branch:[[:space:]]*([^[:space:]]+).*$/\1/p' | head -n 1)
tikvNeedsCdcEnable=false
if [ "$tikvGitCommitBranch" = "cloud-engine" ]; then
tikvNeedsCdcEnable=true
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for detecting the TiKV branch and determining if CDC needs to be enabled is duplicated in tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen. To improve maintainability and ensure consistency across different test startup scripts, consider extracting this logic into a shared function or a common utility script.


# start minio
echo "Starting MinIO server..."
mkdir -p "$TEST_DATA_DIR/minio"
Expand Down Expand Up @@ -221,6 +230,12 @@ lightweight-backup = true
target-file-size = "512MB"
wal-chunk-target-file-size = "128MB"
EOF
if [ "$tikvNeedsCdcEnable" = "true" ]; then
cat >>"$OUT_DIR/upstream-tikv.toml" <<EOF
[cdc]
enable = true
EOF
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The cdc.enable = true configuration is only applied to upstream-tikv.toml. In these integration tests, both upstream and downstream clusters typically use the same TiKV binary. If the cloud-engine branch requires this configuration for proper operation, it should likely be applied to downstream-tikv.toml as well (after it is initialized around line 240) to ensure the downstream cluster starts and behaves correctly.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tenfyzhong PTAL. I think BDR mode needs this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is outdated. I have added the same configuration to the downstream config file on line 263.


touch "$OUT_DIR/downstream-tikv.toml"
if [ -f "$tikv_config" ]; then
Expand Down Expand Up @@ -249,7 +264,6 @@ EOF
echo "Starting upstream TiKV..."
mkdir -p "$TEST_DATA_DIR/upstream"
mkdir -p "$OUT_DIR/log/upstream/tikv"
tikv-server --version
for idx in $(seq 1 3); do
host="UP_TIKV_HOST_$idx"
port="UP_TIKV_PORT_$idx"
Expand All @@ -269,7 +283,6 @@ done
echo "Starting downstream TiKV..."
mkdir -p "$TEST_DATA_DIR/downstream"
mkdir -p "$OUT_DIR/log/downstream/tikv"
tikv-server --version
tikv-server \
--pd "${DOWN_PD_HOST}:${DOWN_PD_PORT}" \
-A "${DOWN_TIKV_HOST}:${DOWN_TIKV_PORT}" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ else
echo "Bucket tls-cse-test already exists, skipping creation"
fi

echo "Checking TiKV version information..."
tikvVersionInfo=$(tikv-server -V 2>&1)
printf '%s\n' "$tikvVersionInfo"
tikvGitCommitBranch=$(printf '%s\n' "$tikvVersionInfo" | sed -nE 's/^Git Commit Branch:[[:space:]]*([^[:space:]]+).*$/\1/p' | head -n 1)
tikvNeedsCdcEnable=false
if [ "$tikvGitCommitBranch" = "cloud-engine" ]; then
tikvNeedsCdcEnable=true
fi

# Tries to limit the max number of open files under the system limit
cat - >"$OUT_DIR/tikv-config-tls.toml" <<EOF
[storage]
Expand All @@ -93,6 +102,12 @@ ca-path = "$TLS_DIR/ca.pem"
cert-path = "$TLS_DIR/server.pem"
key-path = "$TLS_DIR/server-key.pem"
EOF
if [ "$tikvNeedsCdcEnable" = "true" ]; then
cat >>"$OUT_DIR/tikv-config-tls.toml" <<EOF
[cdc]
enable = true
EOF
fi

cat >"$OUT_DIR/tikv-worker-tls.toml" <<EOF
[dfs]
Expand Down Expand Up @@ -176,7 +191,6 @@ cluster-ssl-key = "$TLS_DIR/server-key.pem"
EOF

echo "Starting TLS TiKV..."
tikv-server --version
# Uncomment to turn on grpc versbose log.
# GRPC_VERBOSITY=debug \
# GRPC_TRACE=server_channel,call_error,handshaker,tsi \
Expand Down
Loading