XACT_EVENT for 'commit prepared'

2024-06-07 Thread Xiaoran Wang
Hi hackers, I found that in enum XactEvent, there is 'XACT_EVENT_PREPARE' for 'prepare transaction', but there is no event for 'commit prepared' or 'rollback prepared'. For the following SQL: begin; create table test(a int); PREPARE TRANSACTION

Re: Recovering from detoast-related catcache invalidations

2024-01-14 Thread Xiaoran Wang
ystem_scan, it receives the SharedInvalidationMessages and returns the tuples which are out of date. systable_recheck_tuple is used in dependency.c for such case. Tom Lane 于2024年1月14日周日 03:12写道: > I wrote: > > Xiaoran Wang writes: > >> Hmm, how about first checking if any inva

Re: Recovering from detoast-related catcache invalidations

2024-01-13 Thread Xiaoran Wang
. if (inval_count != SharedInvalidMessageCounter && !systable_recheck_tuple(scandesc, ntp)) { heap_freetuple(dtp); return NULL; } Xiaoran Wang 于2024年1月13日周六 13:16写道: > Great! That's what exactly we need. > > The patch LGTM, +1 > > &g

Re: Recovering from detoast-related catcache invalidations

2024-01-12 Thread Xiaoran Wang
Great! That's what exactly we need. The patch LGTM, +1 Tom Lane 于2024年1月13日周六 04:47写道: > I wrote: > > This is uncomfortably much in bed with the tuple table slot code, > > perhaps, but I don't see a way to do it more cleanly unless we want > > to add some new provisions to that API. Andres,

Re: Recovering from detoast-related catcache invalidations

2024-01-11 Thread Xiaoran Wang
amp; TransactionIdDidCommit(xmax)) { heap_freetuple(dtp); return NULL; I'm not quite sure the code is correct, I cannot clearly understand 'HeapTupleHeaderGetUpdateXid', and I need more time to dive into it. Any thoughts? Tom Lane 于2024年

Re: Recovering from detoast-related catcache invalidations

2024-01-11 Thread Xiaoran Wang
Hi, >> BTW, while nosing around I found what seems like a very nasty related >> bug. Suppose that a catalog tuple being loaded into syscache contains >> some toasted fields. CatalogCacheCreateEntry will flatten the tuple, >> involving fetches from toast tables that will certainly cause >>

Re: Avoid computing ORDER BY junk columns unnecessarily

2023-12-22 Thread Xiaoran Wang
Hi Heikii, I haven't dug into your patch yet, but for this problem, I have another idea. --- explain verbose select foo from mytable order by sha256(bar::bytea); QUERY PLAN

Re: [PATCH]: Not to invaldiate CatalogSnapshot for local invalidation messages

2023-12-21 Thread Xiaoran Wang
Hi, I updated the comment about the CatalogSnapshot `src/backend/utils/time/ snapmgr.c` Xiaoran Wang 于2023年12月18日周一 15:02写道: > Hi, > Thanks for your reply. > > jian he 于2023年12月18日周一 08:20写道: > >> Hi >> ---setup. >> drop table s2; >> create table s2(a int

Re: [PATCH]: Not to invaldiate CatalogSnapshot for local invalidation messages

2023-12-17 Thread Xiaoran Wang
Hi, Thanks for your reply. jian he 于2023年12月18日周一 08:20写道: > Hi > ---setup. > drop table s2; > create table s2(a int); > > After apply the patch > alter table s2 add primary key (a); > > watch CatalogSnapshot > > #0 GetNonHistoricCatalogSnapshot (relid=1259) > at >

Re: [PATCH]: Not to invaldiate CatalogSnapshot for local invalidation messages

2023-12-12 Thread Xiaoran Wang
not the same as the transaction “CurrentSnapshot”, but we can still update the CatalogSnapshot’s “curcid”, as the “curcid” only be checked when the tuple is inserted or deleted by the current transaction. Xiaoran Wang 于2023年12月7日周四 10:13写道: > Hi hackers, > > > For loc

[PATCH]: Not to invaldiate CatalogSnapshot for local invalidation messages

2023-12-06 Thread Xiaoran Wang
Hi hackers, For local invalidation messages, there is no need to call `InvalidateCatalogSnapshot` to set the CatalogSnapshot to NULL and rebuild it later. Instead, just update the CatalogSnapshot's `curcid` in `SnapshotSetCommandId`, this way can make the CatalogSnapshot work well too. This

[PATCH] update the comment in SnapshotSetCommandId

2023-08-07 Thread Xiaoran Wang
Hi, I updated the comment in 'SnapshotSetCommandId' in this patch which specifies the reason why it is not necessary to update 'curcid' of CatalogSnapshot. Best regards, xiaoran 0001-Update-the-comment-in-SnapshotSetCommandId.patch Description:

About `GetNonHistoricCatalogSnapshot`: does it allow developers to use catalog snapshot to scan non-catalog tables?

2023-07-13 Thread Xiaoran Wang
Hi, I have a question about the routine "GetNonHistoricCatalogSnapshot".​ It has a param "Oid relid​​". It firstly checks if the relation has systemcache or ​if it is in "RelationInvalidatesSnapshotsOnly" related relations. If yes, it will invalidate the CatalogSnapshot. I just wonder in which

Re: [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog

2023-05-12 Thread Xiaoran Wang
From: tender wang Sent: Thursday, May 11, 2023 3:26 PM To: Tom Lane Cc: Bharath Rupireddy ; Xiaoran Wang ; pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog !! External Email Tom Lane mailto:t

Re: [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog

2023-05-10 Thread Xiaoran Wang
, NoLock); /* do not unlock till end of xact */​ this line is a little confusing since there is no lock on the relation at all. So I think it's better to use RelationColse here. From: tender wang Sent: Wednesday, May 10, 2023 10:57 AM To: Xiaoran Wang Cc

[PATCH] Use RelationClose rather than table_close in heap_create_with_catalog

2023-03-18 Thread Xiaoran Wang
Hi hackers, In heap_create_with_catalog, the Relation new_rel_desc is created by RelationBuildLocalRelation, not table_open. So it's better to call RelationClose to release it. What's more, the comment for it seems useless, just delete it. Thanks!

postgres_fdw: dead lock in a same transaction when postgres_fdw server is lookback

2022-09-30 Thread Xiaoran Wang
Hi, I created a postgers_fdw server lookback as the test does. Then run the following SQLs create table t1(c0 int); insert into t1 values(1); create foreign table ft1( c0 int ) SERVER loopback OPTIONS (schema_name 'public', table_name 't1'); Then started a transaction that runs queries on

[patch] Adding an assertion to report too long hash table name

2022-09-28 Thread Xiaoran Wang
Hi, The max size for the shmem hash table name is SHMEM_INDEX_KEYSIZE - 1. but when the caller uses a longer hash table name, it doesn't report any error, instead it just uses the first SHMEM_INDEX_KEYSIZE -1 chars as the hash table name. I created some shmem hash tables with the same prefix

Add an assert to the length of shared hashtable name

2022-09-25 Thread Xiaoran Wang
The max size for the shared memory hash table name is SHMEM_INDEX_KEYSIZE - 1 (shared hash table name is stored and indexed by ShmemIndex hash table, the key size of it is SHMEM_INDEX_KEYSIZE), but when the caller uses a longer hash table name, it doesn't report any error, instead it just