Hello,
I am running YugabyteDB 2.14.0.0 on 3 node setup, where on each node 1 yb-master and 1 yb-tserver is running. On one of the nodes I create a database via createdb utility and then I run an SQL script containing only DDL statements (e.g., CREATE TABLE, CREATE VIEW, CREATE FUNCTION, etc.) via ysqlsh utility:
ysqlsh -v ON_ERROR_STOP=1 -f my_ddl.sql my_database
Sometimes this script runs successfully to completion, but most of the times it fails with an error related to transactions, such as the following:
- ERROR: Operation failed. Try again: Unknown transaction, could be recently aborted: 9a3ac51d-494f-42e9-bd5d-48074d401ae7
- ERROR: Operation expired: Heartbeat: Transaction de8093bb-7b36-4317-82d8-9675665f4ba4 expired or aborted by a conflict: 40001
At the time the above script is running there are no other connections to the database.
Is there anything we can do in our setup or in our script to eliminate such errors? We need to find a way to get this script running reliably, as it is intended to be executed by an automated build process.
Also, is there anything that we can do to speed up the execution of this script? I noticed that it takes about 4-5 seconds to create a table or an index, unless the table primary key or the index uses range partitioning (i.e., not hash), in which case it takes about 1 second. In the case where the script successfully finishes, this means that it takes about a half hour (30 minutes) to complete (it creates 246 tables and 138 indices). We are certainly not expecting the same time required for executing such operations in PostgreSQL (that is on the order of several seconds), but we would appreciate any guidance for improving the execution time. (For example, do we need to start up yb-master and yb-tserver processes with certain flags?)
The yb-master was started on each node using a command of the following form:
nohup yb-master --master_addresses IP1:7100,IP2:7100,IP3:7100 \
--rpc_bind_addresses LOCAL_NODE_IP:7100 \
--fs_data_dirs /data/vlst/yugabyte/yugabyte-2.14.0.0/data \
--max_log_size 100 &> yb-master.out &
and the yb-tserver was brought up on each node with a command of this format:
nohup yb-tserver --tserver_master_addrs IP1:7100,IP2:7100,IP3:7100 \
–rpc_bind_addresses LOCAL_NODE_IP:9100 \
–fs_data_dirs /data/vlst/yugabyte/yugabyte-2.14.0.0/data \
--max_log_size 100 \
--start_pgsql_proxy \
--pgsql_proxy_bind_address LOCAL_NODE_IP:5433 \
--ysql_log_statement all \
--ysql_timezone LOCAL_TIMEZONE \
--pg_yb_session_timeout_ms 900000 \
--cql_proxy_bind_address LOCAL_NODE_IP:9042 \
--cql_rpc_keepalive_time_ms 0 \
--ysql_client_read_write_timeout_ms 300000 \
--yb_client_admin_operation_timeout_sec 300 &> yb-tserver.out &
Your input is greatly appreciated.
Thank you