Skip to content

Commit

Permalink
[#22379]YSQL: Suppress Notice messages while setting yb_read_time fro…
Browse files Browse the repository at this point in the history
…m walsender

Summary:
Currently whenever yb_read_time is set, a NOTICE message is issued. However, the walsender sets the yb_read_time for DDLs and publication refresh processing. This can lead to unnecessary clutter of NOTICE messages, hence we want to suppress the logging of NOTICE message when yb_read_time is being set from the walsender. This diff introduces the changes required for the same.

The decision to log the NOTICE message is taken on the basis of `am_walsender` boolean, which is true for a walsender process and false otherwise.
Jira: DB-11279

Test Plan: Existing tests

Reviewers: stiwary, asrinivasan

Reviewed By: stiwary

Subscribers: yql, ycdcxcluster

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D35030
  • Loading branch information
Sumukh-Phalgaonkar committed May 14, 2024
1 parent b4f3213 commit 12b6c74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/postgres/src/backend/replication/logical/yb_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ YBHandleRelcacheRefresh(LogicalDecodingContext *ctx, XLogReaderState *record)
if (needs_invalidation)
{
uint64_t read_time_ht;
char read_time[50];
bool for_startup;

for_startup = ctx->yb_handle_relcache_invalidation_startup;
Expand All @@ -512,10 +511,7 @@ YBHandleRelcacheRefresh(LogicalDecodingContext *ctx, XLogReaderState *record)
read_time_ht = record->yb_virtual_wal_record->commit_time;
}

sprintf(read_time, "%" PRIu64 " ht", read_time_ht);
elog(DEBUG1, "Setting yb_read_time to %s", read_time);
assign_yb_read_time(read_time, NULL);
YbRelationCacheInvalidate();
YBCUpdateYbReadTimeAndInvalidateRelcache(read_time_ht);

/*
* Let the plugin know that the schema for this table has
Expand Down
15 changes: 9 additions & 6 deletions src/postgres/src/backend/utils/misc/pg_yb_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -4045,12 +4045,15 @@ assign_yb_read_time(const char* newval, void *extra)
parse_yb_read_time(newval, &value_ull, &is_ht_unit);
yb_read_time = value_ull;
yb_is_read_time_ht = is_ht_unit;
ereport(NOTICE,
(errmsg("yb_read_time should be set with caution."),
errdetail("No DDL operations should be performed while it is set and "
"it should not be set to a timestamp before a DDL "
"operation has been performed. It doesn't have well defined semantics"
" for normal transactions and is only to be used after consultation")));
if (!am_walsender)
{
ereport(NOTICE,
(errmsg("yb_read_time should be set with caution."),
errdetail("No DDL operations should be performed while it is set and "
"it should not be set to a timestamp before a DDL "
"operation has been performed. It doesn't have well defined semantics"
" for normal transactions and is only to be used after consultation")));
}
}

void
Expand Down

0 comments on commit 12b6c74

Please sign in to comment.