Live Saving Tool - minirepro

You may encounter the following problems when using MatrixDB:

  • 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. Users only need to provide executed SQL to generate a site environment through this tool for technicians to reproduce and track down in the local environment.

How to use minirepro

minirepro will be installed with MatrixDB 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.

Use minirepro to perform on-site saving of SQL, first of all, you must store the SQL statements in a file. For example: To save the SQL statement SELECT * FROM data; execution site, save it in the file query.sql:

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

Then execute the command, connect to the database and specify the SQL file and the 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, and its contents contain data tables and related catalog information. Just provide this document to the technician.