diskquota icon indicating copy to clipboard operation
diskquota copied to clipboard

Add DiskquotaStatus.

Open zhrt123 opened this issue 1 year ago • 2 comments

This PR adds a DiskquotaStatus struct to maintain the shared memory usage caused by TableSizeMap and QuotaInfoMap.

Let's use TableSizeEntry as the example:

  • totale_table_size_entries: the TableSizeEntry count in all bgworker.
  • allocated_table_size_entries[workerid]: how many entries are allocated in the current bgworker.

Increase count:

  • When allocated[workerid] == hash_get_num_entries(table_size_map), the hashmap needs to allocate more memory for entries, which depends on choose_nelem_alloc(Size entrysize). Then allocated[workerid] += choose_nelem_alloc().

Decrease count:

  • After using hash_search(HASH_REMOVE) to remove an entry from the table_size_map, the counter in table_size_map will be decreased automatically and the count of allocated memory keeps unchanged.

zhrt123 avatar Sep 07 '23 09:09 zhrt123