Skip to content

Commit fca7e81

Browse files
committed
[#27387] YSQL: Improve logging for incremental catalog cache refresh
Summary: This diff makes two changes to improve logging for incremental catalog cache refresh (1) added DEBUG in the log text to make its purpose clearer (2) changed `messages` to `invalidation messages` in the log to improve readability I tried to also replace YBC_LOG_INFO with elog but that caused some unit tests to fail because they have `SET client_min_messages TO log;`. One difference between `YBC_LOG_INFO` and elog is that in case of `YBC_LOG_INFO` the log only goes into the server log but not to the client. Because incremental catalog cache refresh is a new feature, these `YBC_LOG_INFO` logging are used to assist debugging. Once the feature is rolled out and field tested and we are more confident that it is stable enough, I plan to make them DEBUG log and then replace `YBC_LOG_INFO` with `elog`. Jira: DB-16921 Test Plan: ./yb_build.sh release --cxx-test pg_catalog_version-test Look at the new test logs. E.g.: ``` [ts-2] I0926 18:20:27.510396 1845785 pg_yb_utils.c:3256] YBCommitTransactionContainingDDL: got 26 invalidation messages, local catalog version 2 ``` ``` [ts-1] I0926 18:20:32.236284 1845757 pg_yb_utils.c:3114] DEBUG: pg null=0, nmsgs=4 ``` Reviewers: jason Reviewed By: jason Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D46997
1 parent 66a676d commit fca7e81

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/postgres/src/backend/utils/misc/pg_yb_utils.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3085,7 +3085,8 @@ YBCommitTransactionContainingDDL()
30853085

30863086
if (nmsgs > max_allowed)
30873087
{
3088-
elog(LOG, "too many messages: %d, max allowed %d", nmsgs, max_allowed);
3088+
elog(LOG, "too many invalidation messages: %d, max allowed %d",
3089+
nmsgs, max_allowed);
30893090
/*
30903091
* If we have too many invalidation messages, write PG null into
30913092
* messages so that we fall back to do catalog cache refresh.
@@ -3112,10 +3113,10 @@ YBCommitTransactionContainingDDL()
31123113
}
31133114
else
31143115
Assert(nmsgs == 0);
3115-
YBC_LOG_INFO("pg null=%d, nmsgs=%d", !currentInvalMessages, nmsgs);
3116+
YBC_LOG_INFO("DEBUG: pg null=%d, nmsgs=%d", !currentInvalMessages, nmsgs);
31163117
}
31173118
else if (ddl_transaction_state.num_committed_pg_txns > 0)
3118-
YBC_LOG_INFO("num_committed_pg_txns: %d",
3119+
YBC_LOG_INFO("DEBUG: num_committed_pg_txns: %d",
31193120
ddl_transaction_state.num_committed_pg_txns);
31203121

31213122
/* Clear yb_sender_pid for unit test to have a stable result. */
@@ -3254,8 +3255,8 @@ YBCommitTransactionContainingDDL()
32543255
}
32553256
YBClearDdlHandles();
32563257
if (increment_done)
3257-
YBC_LOG_INFO("%s: got %d messages, local catalog version %" PRIu64,
3258-
__func__, nmsgs, yb_catalog_cache_version);
3258+
YBC_LOG_INFO("%s: got %d invalidation messages, local catalog version %" PRIu64,
3259+
__func__, nmsgs, yb_catalog_cache_version);
32593260
}
32603261

32613262
void

0 commit comments

Comments
 (0)