0

When this workload (SqlSecondaryIndex workload from https://github.com/YugaByte/yb-sample-apps/) is still running

% java -jar yb-sample-apps.jar --workload SqlSecondaryIndex --nodes
127.0.0.1:5433 --num_threads_read 4 --num_threads_write 2

an attempt to use ysql_dump to export the table causes "Query error: Restart read required" error.

$ ./ysql_dump -h 127.0.0.1 -d postgres --data-only --table sqlsecondaryindex  -f out.txt
ysql_dump: Dumping the contents of table "sqlsecondaryindex" failed: PQgetResult() failed.
ysql_dump: Error message from server: ERROR:  Query error: Restart read required at: { read: { physical: 1592265362684030 } local_limit: { physical: 1592265375906038 } global_limit: <min> in_txn_limit: <max> serial_no: 0 }

But if the same command is executed when the workload is stopped, then ysql_dump command completes successfully without any issues. Is this expected behavior?

jarlh
  • 42,561
  • 8
  • 45
  • 63
Ricardo Adam
  • 115
  • 5

1 Answers1

0

To read against a consistent snapshot and avoid running into the "read restart" error, pass the --serializable-deferrable option to ysql_dump. For example:

~/tserver/postgres/bin/ysql_dump -h 127.0.0.1 -d postgres \
   --data-only --table sqlsecondaryindex \
   --serializable-deferrable -f data1.csv