From 9c72d68fc218655910aabce1ad5a1516d6831081 Mon Sep 17 00:00:00 2001 From: Linh Nguyen Date: Wed, 11 May 2022 22:14:18 +0000 Subject: [PATCH] Revert "[#12293] YSQL: Use better defaults for copy command" Summary: The previous commits broke the xcluster replication (specifically when setting `ysql_session_max_batch_size` at too high value). The issue was not included in a unit test or integration test. Reverting to the old value fixes the problem. This reverts commit d95a1592d3343563aed7028d2d52c31a3ddc471a. Revert "[#12293] YSQL: Adjust default value in copy test" This reverts commit 3cb638e15f4f622545f2e1b084765f916fa6a38d. Test Plan: jenkins Test with xcluster replication to ensure it resumes working as normal. Reviewers: jhe, slingam, rthallam Reviewed By: slingam, rthallam Subscribers: smishra, yql Differential Revision: https://phabricator.dev.yugabyte.com/D16914 --- java/yb-pgsql/src/test/java/org/yb/pgsql/TestBatchCopyFrom.java | 2 +- src/postgres/src/include/commands/copy.h | 2 +- src/yb/yql/pggate/pggate_flags.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/yb-pgsql/src/test/java/org/yb/pgsql/TestBatchCopyFrom.java b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestBatchCopyFrom.java index a50228731a89..a7d073049ad3 100644 --- a/java/yb-pgsql/src/test/java/org/yb/pgsql/TestBatchCopyFrom.java +++ b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestBatchCopyFrom.java @@ -49,7 +49,7 @@ public class TestBatchCopyFrom extends BasePgSQLTest { "violates foreign key constraint"; private static final String BATCH_TXN_SESSION_VARIABLE_NAME = "yb_default_copy_from_rows_per_transaction"; - private static final int BATCH_TXN_SESSION_VARIABLE_DEFAULT_ROWS = 20000; + private static final int BATCH_TXN_SESSION_VARIABLE_DEFAULT_ROWS = 1000; private static final String DISABLE_TXN_WRITES_SESSION_VARIABLE_NAME = "yb_disable_transactional_writes"; private static final String YB_ENABLE_UPSERT_MODE_VARIABLE_NAME = diff --git a/src/postgres/src/include/commands/copy.h b/src/postgres/src/include/commands/copy.h index 8793c4302d23..40db32c4e828 100644 --- a/src/postgres/src/include/commands/copy.h +++ b/src/postgres/src/include/commands/copy.h @@ -19,7 +19,7 @@ #include "parser/parse_node.h" #include "tcop/dest.h" -#define DEFAULT_BATCH_ROWS_PER_TRANSACTION 20000 +#define DEFAULT_BATCH_ROWS_PER_TRANSACTION 1000 /* CopyStateData is private in commands/copy.c */ typedef struct CopyStateData *CopyState; diff --git a/src/yb/yql/pggate/pggate_flags.cc b/src/yb/yql/pggate/pggate_flags.cc index 588c22a11c94..ce0880e06fd1 100644 --- a/src/yb/yql/pggate/pggate_flags.cc +++ b/src/yb/yql/pggate/pggate_flags.cc @@ -53,7 +53,7 @@ DEFINE_uint64(ysql_prefetch_limit, 1024, DEFINE_double(ysql_backward_prefetch_scale_factor, 0.0625 /* 1/16th */, "Scale factor to reduce ysql_prefetch_limit for backward scan"); -DEFINE_uint64(ysql_session_max_batch_size, 3072, +DEFINE_uint64(ysql_session_max_batch_size, 512, "Use session variable ysql_session_max_batch_size instead. " "Maximum batch size for buffered writes between PostgreSQL server and YugaByte DocDB " "services");