ADBDEV-6442: Refactor diskquota local_table_stats_map #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor diskquota local_table_stats_map
During initialization, diskquota uses a non-optimal structure for the local
hashmap local_table_stats_map. This leads to increased RAM consumption during
cluster startup. This patch changes the specified structure, making the table
oid the key, and the value an array of sizes by segments. This significantly
reduces the amount of memory consumed. This patch also fixes a small bug with
duplicate oid tables in the active_oids string array in the dispatch_rejectmap
function.
Tests are not provided, but you can estimate the hashmap size using the
hash_estimate_size
function, for example, like this:that gives
That is, the memory consumption for 1,000,000 tables on a 1000-segment cluster dropped from 38 gigabytes to 7.5 gigabytes.
It is easier to view the changes with the "Hide whitespace" option enabled.