Resolving Alibaba Cloud DTS Pre-checks: Mapping the ali_decoding Extension for Older Version PostgreSQL (below 10) on Ubuntu
By Andre Kramadibrata, Solution Architect Alibaba Cloud Indonesia
When migrating a self-managed PostgreSQL database to Alibaba Cloud ApsaraDB RDS using the Data Transmission Service (DTS), incremental data migration relies heavily on logical decoding. To facilitate this, Alibaba Cloud requires the installation of their proprietary ali_decoding plugin.
However, a common architectural friction point arises for system administrators running PostgreSQL via Ubuntu’s standard apt package manager.
The official DTS documentation assumes you are working within a source-compiled PostgreSQL environment. If you compile the plugin from source and run make install, the binaries default to the /usr/local/pgsql/ prefix.
Meanwhile, your apt-installed PostgreSQL service is looking for extensions in the Linux Standard Base (LSB) paths (/usr/lib/postgresql/...).
This guide details the "Compile and Map" strategy: building the extension artifacts in a sterile environment and manually mapping them into your production package-managed server.
Phase 1: The Compilation Sandbox
To avoid cluttering your production database server with build tools, it is best practice to compile the extension on a clone or a temporary sandbox instance.
- Install the necessary development headers (postgresql-server-dev-9.6 and build-essential).
- Download the PostgreSQL 9.6 source tree.
- Place the ali_decoding source folder inside the contrib/ directory.
- Run make and make install.
During the make install process, you will notice the system outputs the installation paths. By default, it places the artifacts here:
/usr/local/pgsql/lib/ali_decoding.so
/usr/local/pgsql/share/extension/ali_decoding.control
/usr/local/pgsql/share/extension/ali_decoding--0.0.1.sql
Phase 2: The Critical Folder Mapping
Because your production instance was installed via apt, it will completely ignore the /usr/local/pgsql/ directory. We must manually map the generated artifacts to the exact directories where the apt installation expects to find them.
Here is the necessary mapping matrix for PostgreSQL 9.6:
| Artifact Type | Source Location (Compiled Default) | Target Location (Ubuntu apt Package) |
| Shared Library (.so) | /usr/local/pgsql/lib/ |
/usr/lib/postgresql/9.6/lib/ |
| Control File (.control) | /usr/local/pgsql/share/extension/ |
/usr/share/postgresql/9.6/extension/ |
| SQL Script (.sql) | /usr/local/pgsql/share/extension/ |
/usr/share/postgresql/9.6/extension/ |
Phase 3: Artifact Injection & Permissions
To inject the compiled extension into your production server, transfer the files from your sandbox and execute the following commands to place them in the correct LSB directories.
1. Copy the artifacts:
#Move the compiled binary
sudo cp /path/to/sandbox/ali_decoding.so /usr/lib/postgresql/9.6/lib/
#Move the extension metadata
sudo cp /path/to/sandbox/ali_decoding.control /usr/share/postgresql/9.6/extension/
sudo cp /path/to/sandbox/ali_decoding--*.sql /usr/share/postgresql/9.6/extension/
2. Enforce correct ownership and permissions:
The postgres system user must be able to read and execute these files.
sudo chmod 755 /usr/lib/postgresql/9.6/lib/ali_decoding.so
sudo chmod 644 /usr/share/postgresql/9.6/extension/ali_decoding*
Phase 4: Database Configuration & Activation
With the files mapped correctly, PostgreSQL will now recognize the extension as if it were installed natively via a package manager.
1. Enable Logical Replication:
Edit your /etc/postgresql/9.6/main/postgresql.conf to support DTS logical decoding requirements:
wal_level = logical
max_wal_senders = 10 # Adjust based on concurrent connections
max_replication_slots = 10 # Adjust based on replication slot needs
1.
2. Restart the Service:
Apply the configuration changes.
sudo systemctl restart postgresql
Conclusion
By understanding the routing differences between source-compiled defaults and OS package managers, you can manually bridge the gap for proprietary plugins. Your Alibaba Cloud DTS task should now successfully pass its pre-checks and begin synchronizing your incremental data!
Read previous post:
Boost Your Coding Workflow with Qwen Code: A Practical Guide
Read next post:
Giving Your AI Agent a Disposable Workspace with Alibaba Cloud AgentRun
-
-
Alibaba Cloud Indonesia
128 posts | 23 followers
Follow
Comments
-
-
Alibaba Cloud Indonesia
128 posts | 23 followers
Follow
Related Products
-
PolarDB for PostgreSQL
Alibaba Cloud PolarDB for PostgreSQL is an in-house relational database service 100% compatible with PostgreSQL and highly compatible with the Oracle syntax.
Learn More -
Time Series Database (TSDB)
TSDB is a stable, reliable, and cost-effective online high-performance time series database service.
Learn More -
Big Data Consulting for Data Technology Solution
Alibaba Cloud provides big data consulting services to help enterprises leverage advanced data technology.
Learn More -
Data Security Center (Original SDDP)
An all-in-one data security solution that provides various features, such as sensitive data detection, classification, grading, and de-identification, to help you meet compliance requirements specified in General Data Protection Regulation (GDPR) and personal information protection
Learn More
More Posts by Alibaba Cloud Indonesia
- Stop Rebuilding Your App for AI. Add an Agent Instead.
- Giving Your AI Agent a Disposable Workspace with Alibaba Cloud AgentRun
- Boost Your Coding Workflow with Qwen Code: A Practical Guide
- Building an Enterprise-Grade Cloud Backbone: Connecting VPCs with Alibaba Cloud CEN
- Entering the AI-Native Era: How DAS Leverages LLMs to Revolutionize Database Autonomy
- Getting Started with Qoder - A Step-by-Step Guide for Teams
- Will AI Replace You? The Risks, Opportunities, and How to Prepare Across Seven Key Industries
- Building Skills for Qoder: A Developer's Guide
- Self-Hosted GPU or Model-as-a-Service? A Strategic Guide for AI Leaders