Re: Proposal: Recent mutated table tracking in memory

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: nadav(at)tailorbrands(dot)com
Cc: pgpool-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Proposal: Recent mutated table tracking in memory
Date: 2026-02-26 07:47:42
Message-ID: 20260226.164742.1123136102374463742.ishii@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-hackers

> Added some handling for possible causes - works now.

Here are comments for the patch.

- Some code lines are too long. We recommend to limit each source code
line up to 78 chars. You can use following script to detect too long
lines (you can ignore reports other than *.[c]) See
https://wiki.postgresql.org/wiki/Committing_checklist

git diff origin/master | grep -E '^(\+|diff)' | sed 's/^+//' | expand -t4 | awk "length > 78 || /^diff/"

--- /dev/null
+++ b/src/test/regression/tests/043.track_table_mutation_watchdog/.gitignore

Please avoid to install .gitignore. .gitignore file are maintained by
pgpool core developers.

+++ b/src/test/regression/tests/043.track_table_mutation_watchdog/leader.conf

To test watchdog, you should use the standard watchdog_setup too.

+++ b/src/utils/pool_track_table_mutation.c

+static inline void
+query_cache_lock(void)

"query_cache_*" is confusing since we already have query cache
feature. Please use different name.

+static int
+track_table_mutation_get_database_oid_internal(void)
+{
:
:
+ /* Ensure we have a valid query context */
+ if (session_context->query_context == NULL)
+ return oid;

Why does this need? The query context is not used in this function.

+/* ----------------
+ * Public API implementation
+ * ----------------
+ */

Please add a comments on what these function do.

+Size
+pool_track_table_mutation_shmem_size(void)

+void
+pool_track_table_mutation_init(void)

+void
+pool_track_table_mutation_child_init(void)

+bool
+pool_track_table_mutation_in_cold_start(void)

+void
+pool_track_table_mutation_trigger_global_cold_start(void)

+bool
+pool_track_table_mutation_table_is_stale(int table_oid, int dboid)

__sync_fetch_and_add are old functions. I recommend to replace with
ordinary statements using semaphore to protect the critical region.

+ __sync_fetch_and_add(&track_table_mutation_shmem->state.stats_queries_checked, 1);

Please add a comments on what these function do.

+pool_track_table_mutation_mark_tables_written(const int *table_oids, int num_tables, int dboid)

+void
+pool_track_table_mutation_update_ttl(uint64 delay_us)

+bool
+pool_track_table_mutation_get_cached_parse(uint64 hash, bool *is_write,

+void
+pool_track_table_mutation_cache_parse(uint64 hash, bool is_write,
+ const char table_names[][TRACK_TABLE_MUTATION_TABLE_NAME_LEN],
+ int num_tables)

+uint64
+pool_track_table_mutation_normalize_and_hash(const char *query)

Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

In response to

Responses

Browse pgpool-hackers by date

  From Date Subject
Next Message Nadav Shatz 2026-02-26 15:26:33 Re: Proposal: Recent mutated table tracking in memory
Previous Message Tatsuo Ishii 2026-02-26 00:02:14 Re: Proposal: Recent mutated table tracking in memory