×
Community Blog Resolving Alibaba Cloud DTS Pre-checks: Mapping the ali_decoding Extension for Older Version PostgreSQL (below 10) on Ubuntu

Resolving Alibaba Cloud DTS Pre-checks: Mapping the ali_decoding Extension for Older Version PostgreSQL (below 10) on Ubuntu

This guide details how to build the extension artifacts in a sterile environment and manually mapping them into your production package-managed server.

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.

  1. Install the necessary development headers (postgresql-server-dev-9.6 and build-essential).
  2. Download the PostgreSQL 9.6 source tree.
  3. Place the ali_decoding source folder inside the contrib/ directory.
  4. 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!

0 1 0
Share on

Alibaba Cloud Indonesia

126 posts | 22 followers

You may also like

Comments