Failed to Install the TokuDB Engine for the Percona Database
Symptom
On the Kunpeng server running CentOS 7.6, the TokuDB engine fails to be installed for the Percona database, and a message is displayed indicating that libjemalloc.so.1 cannot be loaded. The message is as follows:
ERROR: Connot find libjemalloc.so.1 library. Make sure you have libjemalloc1 on debian|ubuntu or jemalloc on centos package installed.

Key Process and Cause Analysis
- View library files generated during jemalloc installation. It shows that libjemalloc.so.2 is generated based on jemalloc 5.2.1.

- View code related to jemalloc in Percona. It shows that Percona invokes the libjemalloc.so.1 library file.

- Use jemalloc of an earlier version, for example, jemalloc 3.6. The libjemalloc.so.1 library file is generated.

However, a message is displayed, indicating that the jemalloc version is earlier than 2.3.0, but jemalloc 3.6 is later than 2.3.0. Therefore, the problem is not caused by the jemalloc version.

- According to related documents, TokuDB code searches the jemalloc source package for the jemalloc version.
- After the jemalloc source package downloaded from the Internet is decompressed, no jemalloc version information can be obtained. Only one VERSION file is generated when the autogen.sh script is executed. The file contains only zeros. TokuDB code retrieves this VERSION file.

Conclusion and Solution
This problem is irrelevant to the jemalloc version. That is, it does not matter whether the library file is libjemalloc.so.1 or libjemalloc.so.2. This problem is only related to the content of the VERSION file.
- Delete existing jemalloc library files.
rm -rf libjemalloc.so.1 rm -rf libjemalloc.so.2
- Before compiling jemalloc, create a VERSION file in the jemalloc source package and add the following content to this file:
5.2.1-0-g0000000000000000000000000000000000000000

- Compile jemalloc again in the jemalloc source code path to generate a new jemalloc library file.
./autogen.sh Make ./configure make install
- Reinstall the TokuDB engine.
INSTALL PLUGIN tokudb SONAME 'ha_tokudb.so';
- Check the TokuDB engine status. The command output shows that TokuDB has been loaded successfully.
show engines;

Parent topic: Other
