Skip to content

fix "Unknown error" when configuring regions#11806

Merged
dlambrig merged 2 commits into
apple:mainfrom
MarkSh1:main-XDB-304
Apr 24, 2025
Merged

fix "Unknown error" when configuring regions#11806
dlambrig merged 2 commits into
apple:mainfrom
MarkSh1:main-XDB-304

Conversation

@MarkSh1

@MarkSh1 MarkSh1 commented Nov 22, 2024

Copy link
Copy Markdown
Contributor

When executing the command "fdbcli --exec 'fileconfigure..." the error message "ERROR: unknown parameter" is displayed.
The error occurred in
ConfigurationResult buildConfiguration(std::vector const& modeTokens, std::map<std::string, std::string>& outConf);
since the vector of modeTokens included reference to an empty string that got into the vector in the function
ConfigurationResult buildConfiguration(std::string const& configMode, std::map<std::string, std::string>& outConf);
since the configMode begins from empty string which added in
std::string DatabaseConfiguration::configureStringFromJSON(const StatusObject& json)

test.sh:

#!/bin/bash

set -euo pipefail

log() {
    echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
}

check_commands() {
    for cmd in curl dpkg fdbcli; do
        if ! command -v $cmd &> /dev/null; then
            log "Error: $cmd is not installed"
            exit 1
        fi
    done
}

main() {

    if [ $# -eq 0 ]; then
      echo "No fdbcli provided. Usage: $0 fdbcli-path"
      exit 1
    fi

    local FDBCLI_PATH=$1  # Get path to fdbcli binary from first argument

    if ! [ -f "$FDBCLI_PATH" ]; then
      log "Error: No custom fdbcli binary provided or file not found"
      exit 1
    fi


    log "Starting FoundationDB in multiregional mode..."

    # 1. Create region configuration file
    log "Creating region.json configuration"
    cat > region.json <<EOF
{
    "regions": [
        {
            "datacenters": [
                { "id": "dc1", "priority": 0 }
            ]
        }
    ]
}
EOF

    # 2. Stop and remove old version
    log "Stopping FoundationDB service"
    service foundationdb stop || true

    log "Removing old packages"
    dpkg --purge foundationdb-server foundationdb-clients || true

    log "Cleaning up directories"
    rm -rf /var/log/foundationdb /var/lib/foundationdb /etc/foundationdb

    # 3. Download and install new packages
    log "Downloading packages"
    VERSION="7.3.63"
    BASE_URL="https://github.com/apple/foundationdb/releases/download/${VERSION}"

    for pkg in clients server; do
        FILE="foundationdb-${pkg}_${VERSION}-1_amd64.deb"
        if [ ! -f "$FILE" ]; then
            curl -LO "${BASE_URL}/${FILE}" || {
                log "Failed to download $FILE"
                exit 1
            }
        fi
    done

    log "Installing packages"
    dpkg -i foundationdb-clients_${VERSION}-1_amd64.deb || {
        log "Failed to install clients package"
        exit 1
    }

    dpkg -i foundationdb-server_${VERSION}-1_amd64.deb || {
        log "Failed to install server package"
        exit 1
    }

    # 4. Configure FoundationDB, add datacenter-id
    log "Configuring FoundationDB, add datacenter-id"
    CONFIG_FILE="/etc/foundationdb/foundationdb.conf"
    sed -i '/\[fdbserver\.4500\]/a datacenter-id = dc1' "$CONFIG_FILE"

    # 5. Apply region configuration
    log "Applying region configuration"

    if ! fdbcli --exec "fileconfigure region.json" &> /dev/null; then
        exit_code=$?
        log "[ERROR] First configuration attempt failed (exit code: $exit_code)"
        log "Installing custom fdbcli from $FDBCLI_PATH"
        cp "$FDBCLI_PATH" /usr/bin/ || {
                log "Failed to copy $FDBCLI_PATH to /usr/bin/"
                exit 1
            }

        if ! fdbcli --exec "fileconfigure region.json" &> /dev/null; then
            retry_exit_code=$?
            log "[CRITICAL ERROR] Fallback also failed (exit code: $retry_exit_code)"
            exit $retry_exit_code
        fi
    fi

    # 6. Verify configuration
    log "Verifying configuration"
    if fdbcli --exec "status" | grep -q "Regions:"; then
        log "[OK] Regions configuration applied"
    else
        log "[ERROR] Regions configuration not found"
        exit 1
    fi

    log "FoundationDB reconfiguration completed successfully"
}

check_commands
main "$@"

Result:

./test.sh fdbcli
[2025-04-23 13:45:13] Starting FoundationDB in multiregional mode...
[2025-04-23 13:45:13] Creating region.json configuration
[2025-04-23 13:45:13] Stopping FoundationDB service
[2025-04-23 13:45:14] Removing old packages
(Reading database ... 82802 files and directories currently installed.)
Removing foundationdb-server (7.3.63) ...
Purging configuration files for foundationdb-server (7.3.63) ...
FoundationDB does not delete data, log or cluster files on purge.
To remove these files, run (as root):
  # rm -rf /var/lib/foundationdb /var/log/foundationdb
  # rm /etc/foundationdb/fdb.cluster
dpkg: warning: while removing foundationdb-server, directory '/var/log/foundationdb' not empty so not removed
dpkg: warning: while removing foundationdb-server, directory '/var/lib/foundationdb/data' not empty so not removed
Removing foundationdb-clients (7.3.63) ...
Purging configuration files for foundationdb-clients (7.3.63) ...
dpkg: warning: while removing foundationdb-clients, directory '/etc/foundationdb' not empty so not removed
[2025-04-23 13:45:15] Cleaning up directories
[2025-04-23 13:45:15] Downloading packages
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 67.5M  100 67.5M    0     0  32.9M      0  0:00:02  0:00:02 --:--:-- 64.1M
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 33.7M  100 33.7M    0     0  21.9M      0  0:00:01  0:00:01 --:--:-- 56.3M
[2025-04-23 13:45:18] Installing packages
Selecting previously unselected package foundationdb-clients.
(Reading database ... 82770 files and directories currently installed.)
Preparing to unpack foundationdb-clients_7.3.63-1_amd64.deb ...
Unpacking foundationdb-clients (7.3.63) ...
Setting up foundationdb-clients (7.3.63) ...
Selecting previously unselected package foundationdb-server.
(Reading database ... 82794 files and directories currently installed.)
Preparing to unpack foundationdb-server_7.3.63-1_amd64.deb ...
Unpacking foundationdb-server (7.3.63) ...
Setting up foundationdb-server (7.3.63) ...
>>> configure new single memory
Database created
>>> status
Using cluster file `/etc/foundationdb/fdb.cluster'.

Unable to retrieve all status information.

Configuration:
  Redundancy mode        - single
  Storage engine         - memory
  Log engine             - ssd-2
  Encryption at-rest     - disabled
  Coordinators           - 1
  Desired Commit Proxies - 3
  Desired GRV Proxies    - 1
  Desired Resolvers      - 1
  Desired Logs           - 3
  Usable Regions         - 1

Cluster:
  FoundationDB processes - 1
  Zones                  - unknown
  Machines               - 0
  Fault Tolerance        - 0 machines
  Server time            - 04/23/25 13:45:24

Data:
  Replication health     - unknown
  Moving data            - unknown
  Sum of key-value sizes - unknown
  Disk space used        - unknown

Operating space:
  Unable to retrieve operating space status

Workload:
  Read rate              - 0 Hz
  Write rate             - 0 Hz
  Transactions started   - 0 Hz
  Transactions committed - 0 Hz
  Conflict rate          - 0 Hz

Backup and DR:
  Running backups        - 0
  Running DRs            - 0

Client time: 04/23/25 13:45:24
[2025-04-23 13:45:24] Configuring FoundationDB, add datacenter-id
[2025-04-23 13:45:24] Applying region configuration
[2025-04-23 13:45:26] [ERROR] First configuration attempt failed (exit code: 0)
[2025-04-23 13:45:26] Installing custom fdbcli from fdbcli
[2025-04-23 13:45:27] Verifying configuration
[2025-04-23 13:45:27] [OK] Regions configuration applied
[2025-04-23 13:45:27] FoundationDB reconfiguration completed successfully

@jzhou77 jzhou77 closed this Nov 22, 2024
@jzhou77 jzhou77 reopened this Nov 22, 2024
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 97d3077
  • Duration 0:04:47
  • Result: ❌ FAILED
  • Error: Error while executing command: cmake -S . -B build_output -D USE_CCACHE=ON -D USE_WERROR=ON -D RUN_JUNIT_TESTS=ON -D RUN_JAVA_INTEGRATION_TESTS=ON -D BUILD_DOCUMENTATION=ON -D BUILD_AWS_BACKUP=OFF -G Ninja. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-ide on Linux CentOS 7

  • Commit ID: 97d3077
  • Duration 0:19:24
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux CentOS 7

  • Commit ID: 97d3077
  • Duration 0:28:44
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all packages strip_targets. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: 97d3077
  • Duration 0:32:13
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all packages strip_targets. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: 97d3077
  • Duration 0:33:14
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all packages strip_targets. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@jzhou77

jzhou77 commented Nov 23, 2024

Copy link
Copy Markdown
Collaborator

Can you rebase your PR with main branch? We fixed a few compiling issues.

@MarkSh1

MarkSh1 commented Nov 27, 2024

Copy link
Copy Markdown
Contributor Author

Can you rebase your PR with main branch? We fixed a few compiling issues.

How to rerun CI ?

@johscheuer johscheuer closed this Nov 27, 2024
@johscheuer johscheuer reopened this Nov 27, 2024
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-ide on Linux CentOS 7

  • Commit ID: 010ed46
  • Duration 0:24:04
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux CentOS 7

  • Commit ID: 010ed46
  • Duration 0:42:00
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: 010ed46
  • Duration 0:50:38
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 010ed46
  • Duration 0:56:01
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: 010ed46
  • Duration 1:02:55
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@MarkSh1

MarkSh1 commented Nov 28, 2024

Copy link
Copy Markdown
Contributor Author

I rebased PR with apple/main again. Please run CI.

Can you rebase your PR with main branch? We fixed a few compiling issues.

@jzhou77 jzhou77 closed this Nov 28, 2024
@jzhou77 jzhou77 reopened this Nov 28, 2024
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-ide on Linux CentOS 7

  • Commit ID: 1727cda
  • Duration 0:22:53
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux CentOS 7

  • Commit ID: 1727cda
  • Duration 0:38:01
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: 1727cda
  • Duration 0:41:49
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

  • Commit ID: 1727cda
  • Duration 0:53:12
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 1727cda
  • Duration 0:55:20
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: 1727cda
  • Duration 0:56:53
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos on macOS Ventura 13.x

  • Commit ID: 1727cda
  • Duration 0:57:42
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@MarkSh1 MarkSh1 deleted the main-XDB-304 branch March 11, 2025 10:11
@MarkSh1 MarkSh1 restored the main-XDB-304 branch March 15, 2025 20:02
@MarkSh1 MarkSh1 reopened this Mar 15, 2025
@MarkSh1

MarkSh1 commented Apr 10, 2025

Copy link
Copy Markdown
Contributor Author

topic in foundationdb forum about this problem : link

@MarkSh1

MarkSh1 commented Apr 18, 2025

Copy link
Copy Markdown
Contributor Author

This ctest failed: 36/73 Test #45: fdb_c_api_test_CApiCorrectnessCallbacksOnExtThr .....................***Failed 3.95 sec Seems unrelated. Retry.

I ran this test and it passes

@MarkSh1

MarkSh1 commented Apr 22, 2025

Copy link
Copy Markdown
Contributor Author

@saintstack , I rebased PR with apple/main and fixed code. The tests should now pass. Please run CI.

@dlambrig dlambrig self-requested a review April 22, 2025 22:42
Comment thread fdbcli/FileConfigureCommand.actor.cpp Outdated
if (isNewDatabase) {
configString = "new" + configString;
} else {
configString.assign(configString.c_str() + 1);

@dlambrig dlambrig Apr 22, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you use configString.erase(0, 1); here rather than assign, as the intent is clearer and it will handle an empty string.

Can you also add a comment that configureStringFromJSON return string has a leading space.

In the PR, describe how you tested.

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.

done

@dlambrig dlambrig self-requested a review April 23, 2025 14:38
@jzhou77 jzhou77 closed this Apr 23, 2025
@jzhou77 jzhou77 reopened this Apr 23, 2025
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-ide on Linux CentOS 7

  • Commit ID: 338b1a8
  • Duration 0:25:58
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: 338b1a8
  • Duration 0:38:02
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all packages strip_targets. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 338b1a8
  • Duration 0:50:11
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux CentOS 7

  • Commit ID: 338b1a8
  • Duration 2:30:38
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: 338b1a8
  • Duration 2:41:23
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@dlambrig dlambrig merged commit 7f43e71 into apple:main Apr 24, 2025
MarkSh1 added a commit to MarkSh1/foundationdb that referenced this pull request Aug 20, 2025
* fix "Unknown error" when  configuring regions

* fix "Unknown error" when configuring regions
MarkSh1 added a commit to MarkSh1/foundationdb that referenced this pull request Aug 20, 2025
* fix "Unknown error" when  configuring regions

* fix "Unknown error" when configuring regions
jzhou77 pushed a commit that referenced this pull request Aug 20, 2025
* fix "Unknown error" when  configuring regions

* fix "Unknown error" when configuring regions
neethuhaneesha pushed a commit to neethuhaneesha/foundationdb that referenced this pull request Feb 25, 2026
* fix "Unknown error" when  configuring regions

* fix "Unknown error" when configuring regions
@MarkSh1 MarkSh1 deleted the main-XDB-304 branch May 18, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants