Live Saving Tool - minirepro

When using YMatrix, you may encounter the following problems:

  • Slow query
  • Query execution failed, etc.

When encountering the above problems, technical support personnel need to intervene in troubleshooting, while technical personnel need to restore the site to make troubleshooting. minirepro is a tool for on-site saving. You only need to provide executed SQL, and you can generate a site environment through this tool for technicians to reproduce and track down in the local environment.

1 How to use minirepro

minirepro will be installed with YMatrix in $GPHOME/bin/minirepro. You can view the usage method through the following command:

[mxadmin@mdw ~]$ minirepro --help
Usage: minirepro <database> [options]

Options:
  --version show program's version number and exit
  -?, --help            Show this help message and exit
  -h HOST, --host=HOST  Specify a remote host
  -p PORT, --port=PORT  Specify a port other than 5432
  -U USER, --user=USER  Connect as someone other than current user
  -q QUERY_FILE         file name that contains the query
  -f OUTPUT_FILE        minirepro output file name
  -l, --hll             Include HLL stats

WARNING: This tool collects statistics about your data, including most common
values, which requires some data elements to be included in the output file.
Please review output file to ensure it is within corporate policy to transport
the output file.

To perform on-site saving using minirepro, you must first store the SQL statements in the file. For example: To save the SQL statement SELECT * FROM data; execute site, save it in the file query.sql:

[mxadmin@mdw ~]$ cat query.sql
SELECT * FROM data;

Then execute the command to connect to the database and specify the SQL file and output file:

[mxadmin@mdw ~]$ minirepro mxadmin -h 127.0.0.1 -U mxadmin -p 5432 -q query.sql -f outfile.sql
Connecting to database: host=127.0.0.1, port=5432, user=mxadmin, db=mxadmin ...
Extracting metadata from query file query.sql ...
psql mxadmin --pset footer --no-psqlrc -Atq -h 127.0.0.1 -p 5432 -U mxadmin -f /tmp/20210729132431/toolkit.sql
Invoking pg_dump to dump DDL ...
pg_dump -h 127.0.0.1 -p 5432 -U mxadmin -sxO mxadmin --relation-oids 32820 --function-oids 0 -f /tmp/20210729132431/pg_dump_out.sql
Writing schema DDLs ...
Writing relation and function DDLs ...
Writing table statistics ...
Writing column statistics ...
Attaching raw query text ...
--- MiniRepro completed! --
WARNING: This tool collects statistics about your data, including most common values, which requires some data elements to be included in the output file.
Please review output file to ensure it is within corporate policy to transport the output file.

In this way, the on-site environment is saved in the outfile.sql file, which contains data tables and related catalog information. Just provide this document to the technician.