packcore

In production environments, the program will occasionally cause cores to occur due to other unknown reasons such as program bugs. The core of the program will not only cause the query execution to fail, but may cause cluster failure in serious cases. Therefore, the generated core file is very important on-site information and needs to be provided to developers for tracking and tracing.

The packcore tool is used to package the generated core files for developers to debug and track.

1 How to use

packcore is a Python tool released with YMatrix. The package core tool is located at:

$GPHOME/sbin/packcore

$GPHOME/sbin is not in the environment variable, so it needs to be used through an absolute path.

How to use:

$GPHOME/sbin/packcore -b $GPHOME/bin/postgres postgres.core.4_1635732782.17213

in:

  • -b $GPHOME/bin/postgres Specifies the executable file path, because worker processes are derived from postgres master processes
  • postgres.core.4_1635732782.17213 is the generated core file

After executing the command, a .tgz file with the same name as the core file will be generated in the current directory, and the file will be provided to the developer. Includes core files and on-site environment information

2 Generate core file

The prerequisite for using the packcore tool to package core files is that the operating system needs to generate core files.

To generate a core file, you need to modify the following configuration:

2.1 Set the coredump piece size

Set coredump file size unlimited:

ulimit -c unlimited
# Persistence method
echo "ulimit -c unlimited" >> /etc/profile

2.2 Configuring the coredump file path

vi /etc/sysctl.conf

Then add kernel.core_pattern=/home/mxadmin/%e.core.%s_%t to the end

Execute sysctl -p to make the configuration take effect:

sysctl -p

This configuration determines the location and file name template for the core file generation, where:

  • %e: executable file name
  • %s: signal number
  • %t: UNIX timestamp