-
Notifications
You must be signed in to change notification settings - Fork 52
fix(cassandra): support current NVCT task schema #1099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sbaum1994
wants to merge
1
commit into
main
Choose a base branch
from
fix/cassandra-nvct-compatibility
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #!/bin/sh | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -eu | ||
|
|
||
| test_dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd) | ||
| chart_dir=$(CDPATH='' cd -- "${test_dir}/.." && pwd) | ||
| work_dir=$(mktemp -d) | ||
| trap 'rm -rf "${work_dir}"' EXIT | ||
|
|
||
| mkdir -p "${work_dir}/bin" | ||
|
|
||
| cat > "${work_dir}/bin/kubectl" <<'EOF' | ||
| #!/bin/sh | ||
| case "$*" in | ||
| *"get statefulset"*) | ||
| printf '1' | ||
| ;; | ||
| *"get pod"*) | ||
| printf 'true' | ||
| ;; | ||
| *"nodetool statusbinary"*) | ||
| attempts=0 | ||
| if [ -f "${TEST_STATE}" ]; then | ||
| attempts=$(cat "${TEST_STATE}") | ||
| fi | ||
| attempts=$((attempts + 1)) | ||
| printf '%s\n' "${attempts}" > "${TEST_STATE}" | ||
| if [ "${attempts}" -eq 1 ]; then | ||
| printf 'not running\n' | ||
| else | ||
| printf 'running\n' | ||
| fi | ||
| ;; | ||
| *"cqlsh"*) | ||
| cat >/dev/null | ||
| attempts=0 | ||
| if [ -f "${TEST_AUTH_STATE}" ]; then | ||
| attempts=$(cat "${TEST_AUTH_STATE}") | ||
| fi | ||
| attempts=$((attempts + 1)) | ||
| printf '%s\n' "${attempts}" > "${TEST_AUTH_STATE}" | ||
| if [ "${attempts}" -le 2 ]; then | ||
| exit 1 | ||
| fi | ||
| ;; | ||
| *) | ||
| printf 'unexpected kubectl command: %s\n' "$*" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| EOF | ||
|
|
||
| cat > "${work_dir}/bin/sleep" <<'EOF' | ||
| #!/bin/sh | ||
| exit 0 | ||
| EOF | ||
|
|
||
| chmod +x "${work_dir}/bin/kubectl" "${work_dir}/bin/sleep" | ||
|
|
||
| export TEST_STATE="${work_dir}/native-transport-attempts" | ||
| export TEST_AUTH_STATE="${work_dir}/authentication-attempts" | ||
| output=$( | ||
| PATH="${work_dir}/bin:${PATH}" \ | ||
| CASSANDRA_USER=cassandra \ | ||
| CASSANDRA_PASSWORD=desired-password \ | ||
| bash "${chart_dir}/helm/scripts/initdb.sh" | ||
| ) | ||
|
|
||
| printf '%s\n' "${output}" | grep -Fq \ | ||
| 'Waiting for Cassandra native transport on pod cassandra-0...' | ||
| printf '%s\n' "${output}" | grep -Fq \ | ||
| 'Waiting for Cassandra superuser authentication on pod cassandra-0...' | ||
| printf '%s\n' "${output}" | grep -Fq 'Successfully initialized the db' | ||
| [ "$(cat "${TEST_STATE}")" -eq 2 ] | ||
| [ "$(cat "${TEST_AUTH_STATE}")" -eq 5 ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
migrations/cassandra/keyspaces/nvct_api/04_add_task_health.up.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| -- Add the JSON health payload used by current Cloud Tasks releases. | ||
| -- Fresh installs receive this column from 03_init_tables.up.sql. This | ||
| -- migration upgrades keyspaces created from the earlier canonical schema. | ||
|
|
||
| ALTER TABLE nvct_api.tasks_v2 ADD IF NOT EXISTS health TEXT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Keep authentication retries within the initialization deadline.
initialize_dbsets a 600-second deadline.wait_for_superuser_authenticationreplaces it with a new 120-second deadline. If native transport becomes ready near the overall deadline, initialization can wait for an additional 120 seconds. Pass the overall deadline into this function and use the earlier deadline.Proposed fix
wait_for_superuser_authentication() { local pod="$1" - local end=$((SECONDS + 120)) + local deadline="$2" + local auth_end=$((SECONDS + 120)) + if [ "${auth_end}" -gt "${deadline}" ]; then + auth_end="${deadline}" + fi until run_cqlsh "${pod}" "${CASSANDRA_USER}" "${CASSANDRA_PASSWORD}" \ localhost -e "SELECT key FROM system.local;" >/dev/null 2>&1 || \ run_cqlsh "${pod}" "${DEFAULT_CASSANDRA_USER}" "${DEFAULT_CASSANDRA_PASSWORD}" \ localhost -e "SELECT key FROM system.local;" >/dev/null 2>&1; do - if [ $SECONDS -gt "$end" ]; then + if [ "${SECONDS}" -ge "${auth_end}" ]; then echo "Timeout waiting for Cassandra superuser authentication on pod ${pod}" return 1 fi @@ - if ! wait_for_superuser_authentication "${statefulset}-0"; then + if ! wait_for_superuser_authentication "${statefulset}-0" "${end}"; thenAlso applies to: 156-156
🤖 Prompt for AI Agents