Skip to content

Conversation

@pangpang20
Copy link
Collaborator

Description

This pull request refactors the GaussDB driver installation process by moving the installation logic from the README.rst into a standalone, reusable, and idempotent Bash script (tools/install_gaussdb_driver.sh). The script automates the download, extraction, and configuration of the GaussDB driver, supporting multiple operating systems (HCE, CentOS, Euler, Kylin) and architectures (x86_64, aarch64). The refactoring improves maintainability, reduces duplication, and ensures consistent driver installation across different environments.

The changes also include a merge of the latest updates from the master branch to ensure compatibility.

Changes Made

  • README.rst:
    • Removed detailed installation instructions (32 lines) and replaced them with a single command to execute the new install_gaussdb_driver.sh script.
  • tools/install_gaussdb_driver.sh:
    • Added a new Bash script (163 lines) to handle the GaussDB driver installation.
    • Script features:
      • Downloads and extracts the GaussDB driver package.
      • Detects system type (CentOS, HCE, Euler, Kylin) and architecture (x86_64, aarch64).
      • Copies and extracts the appropriate driver package to a dedicated directory.
      • Configures the dynamic linker with the driver library path.
      • Includes logging, error handling, and cleanup for idempotent execution.
      • Verifies successful installation by checking for libpq in the linker cache.
  • Merged the latest changes from the master branch into the current branch.

Testing

  • Tested the install_gaussdb_driver.sh script on the following environments:
    • EulerOS (x86_64, VERSION_ID="2.5" and "2.9")
    • CentOS/HCE (x86_64)
    • Kylin (x86_64)
    • Simulated aarch64 architecture by modifying uname -m output.
  • Verified that the script:
    • Correctly downloads and extracts the driver package.
    • Detects the system and architecture accurately.
    • Configures the dynamic linker and verifies libpq registration.
    • Handles repeated executions without errors (idempotency).
    • Cleans up temporary files after successful installation.
  • Confirmed that the updated README instruction (sh tools/install_gaussdb_driver.sh) works as expected.
  • Validated that the merge from master does not introduce conflicts or regressions.

Additional Notes

  • The script assumes wget, unzip, tar, and ldconfig are installed on the target system. It includes checks for these dependencies and exits with an error if any are missing.
  • The script logs all actions to a timestamped log file (/tmp/gaussdb_driver_install_*.log) for debugging and auditing purposes.
  • Future improvements could include adding support for additional operating systems or architectures as needed.
  • Users should ensure they have sufficient permissions (e.g., sudo) to modify /etc/ld.so.conf and execute ldconfig.

@5xuanwen 5xuanwen merged commit 6def76f into HuaweiCloudDeveloper:master Oct 14, 2025
4 checks passed
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.

2 participants