-
Notifications
You must be signed in to change notification settings - Fork 627
fix(dist): gate init-store on a dedicated init_store.enabled option #3119
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
Changes from all commits
a7b81ce
69ac25e
e698202
a62f6ff
3cb4fda
99d7de8
0dd5a7a
090763a
4c9be3a
95bfe45
4b298bf
906a3ef
1434969
3e505a8
da85e46
ba6b7e7
5268091
9707feb
ff1325a
edf07d0
d45ce1e
78a2b5c
8390c65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/bin/bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| entrypoint="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/docker-entrypoint.sh" | ||
| test_dir="$(mktemp -d)" | ||
| trap 'rm -rf "${test_dir}"' EXIT | ||
|
|
||
| eval "$(awk ' | ||
| /^set_prop\(\) \{/ { capture = 1 } | ||
| capture { print } | ||
| capture && /^\}$/ { exit } | ||
| ' "${entrypoint}")" | ||
|
|
||
| assert_replaced() { | ||
| local separator="$1" | ||
| local file="${test_dir}/config-${separator// /space}" | ||
|
|
||
| printf 'init_store.enabled%sfalse\n' "${separator}" > "${file}" | ||
| set_prop "init_store.enabled" "true" "${file}" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 The added test executes GNU-only |
||
| [[ "$(grep -Ec '^init_store\.enabled=true$' "${file}")" -eq 1 ]] | ||
| } | ||
|
|
||
| assert_line_count() { | ||
| local expected="$1" pattern="$2" file="$3" | ||
| local actual | ||
|
|
||
| actual=$(grep -Ec "${pattern}" "${file}") | ||
| if [[ "${actual}" -ne "${expected}" ]]; then | ||
| echo "expected ${expected} matching lines, got ${actual}" >&2 | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| assert_replaced "=" | ||
| assert_replaced ": " | ||
| assert_replaced " " | ||
|
|
||
| duplicate_file="${test_dir}/config-duplicates" | ||
| printf '%s\n' \ | ||
| 'init_store.enabled=false' \ | ||
| 'init_store.enabled: false' \ | ||
| 'init_store.enabled false' \ | ||
| 'init_store.enabled' \ | ||
| 'unrelated=true' > "${duplicate_file}" | ||
| set_prop "init_store.enabled" "true" "${duplicate_file}" | ||
| assert_line_count 1 \ | ||
| '^[[:space:]]*init_store\.enabled([[:space:]]*[:=]|[[:space:]]+|[[:space:]]*$)' \ | ||
| "${duplicate_file}" | ||
| assert_line_count 1 '^init_store\.enabled=true$' "${duplicate_file}" | ||
| grep -q '^unrelated=true$' "${duplicate_file}" | ||
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.
usePD=truestartup into a fail-fast admin bootstrap.loadMetaFromPD()callsinitAdminUserIfNeeded()unconditionally at line 358, including auth-disabled, remote-auth, and custom-auth configurations thatInitStore.checkAdminBootstrapReachable()explicitly exempts; before this change the same create/default-graph failures were logged and startup continued. A PD write or permission failure in those deployments now prevents startup for an unrelated built-in admin. Please make fatal propagation conditional on the local built-in-auth/disabled-init case, or separate default graph-space initialization from admin bootstrap, and add caller-level tests for no-auth, remote, and custom authenticators.