Skip to content

2.25.2.0-b331

@myang2021 myang2021 tagged this 15 Apr 04:03
Summary:
Currently for the incremental cache refresh is only used for non-error code path:
before executing the next top-level statement, if shared memory catalog
version is newer than local catalog version, we attempt the incremental refresh
optimization and if failed then we call `YBRefreshCache()`, which has the side
effect to cause memory spike.

There are still two error code paths where we still directly call
`YBRefreshCache()` without attempting incremental refresh first. It is also possible
when table schema version increments, many active connections can encounter
the same schema version mismatch error and all come to these two error code paths
at roughly the same time, leading to an aggregated memory spike as bad as before.

I added a new function `YBRefreshCacheWrapper` which encapsulates incremental
refresh and `YBRefreshCache()` together so that we can call `YBRefreshCacheWrapper()`
for both non-error and error cases to reduce the number of `YBRefreshCache()` calls and
therefore reducing the likelihood of memory spikes.

Added a new unit test that would fail before this diff because `YBRefreshCache()` was
invoked in the error handling code path.

Test Plan: ./yb_build.sh --cxx-test pg_catalog_version-test

Reviewers: kfranz, sanketh, mihnea

Reviewed By: kfranz

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D43150
Assets 2
Loading