Skip to content

Commit

Permalink
[#23661] YSQL: Change the default wal_level to logical
Browse files Browse the repository at this point in the history
Summary:
wal_level is a GUC parameter that isn't applicable in YSQL since we don't use the PG WAL. There are a few logical replication clients which
validate the value of wal_level and ensure that it is set to 'logical' before proceeding with replication.

Those clients can fail when the value of wal_level isn't logical even though it isn't really applicable in YSQL. So for user experience, we are
setting the default value as 'logical' so that the number of user steps is reduced.
Jira: DB-12572

Test Plan:
Jenkins: test regex: .*ReplicationSlot.*

./yb_build.sh --java-test 'org.yb.pgsql.TestPgReplicationSlot#testDefaultWalLevel'

Reviewers: asrinivasan, skumar, sumukh.phalgaonkar

Reviewed By: sumukh.phalgaonkar

Subscribers: svc_phabricator, yql, ycdcxcluster

Differential Revision: https://phorge.dev.yugabyte.com/D37930
  • Loading branch information
dr0pdb committed Sep 12, 2024
1 parent dd60793 commit 22b6a47
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2893,4 +2893,12 @@ public void testDynamicTableWithReplicaIdentityChangeWithPgoutput() throws Excep
+ " plugin pgoutput. Consider using output plugin yboutput instead."));
}
}

@Test
public void testDefaultWalLevel() throws Exception {
try (Statement stmt = connection.createStatement()) {
Row row = getSingleRow(stmt, "SHOW wal_level");
assertEquals("logical", row.getString(0));
}
}
}
7 changes: 6 additions & 1 deletion src/postgres/src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ char *wal_consistency_checking_string = NULL;
bool *wal_consistency_checking = NULL;
bool log_checkpoints = false;
int sync_method = DEFAULT_SYNC_METHOD;
int wal_level = WAL_LEVEL_MINIMAL;
/*
* YB NOTE: wal_level is not applicable to YB. So for user experience, we set
* the default to logical, so that any logical replication client doesn't throw
* any errors based on the value of the wal_level.
*/
int wal_level = WAL_LEVEL_LOGICAL;
int CommitDelay = 0; /* precommit delay in microseconds */
int CommitSiblings = 5; /* # concurrent xacts needed to sleep */
int wal_retrieve_retry_interval = 5000;
Expand Down
7 changes: 6 additions & 1 deletion src/postgres/src/backend/utils/misc/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5417,7 +5417,12 @@ static struct config_enum ConfigureNamesEnum[] =
NULL
},
&wal_level,
WAL_LEVEL_REPLICA, wal_level_options,
/*
* YB NOTE: wal_level is not applicable to YB. So for user experience,
* we set the default to logical, so that any logical replication
* client doesn't throw any errors based on the value of the wal_level.
*/
WAL_LEVEL_LOGICAL, wal_level_options,
NULL, NULL, NULL
},

Expand Down

0 comments on commit 22b6a47

Please sign in to comment.