Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-07 Thread Masahiko Sawada
On Thu, Mar 7, 2024 at 8:06 PM John Naylor wrote: > > On Thu, Mar 7, 2024 at 4:47 PM Masahiko Sawada wrote: > > > > On Thu, Mar 7, 2024 at 6:37 PM John Naylor wrote: > > > > $ git grep 'link_with: pgport_srv' > > > src/test/modules/test_radixt

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-07 Thread Masahiko Sawada
could be the culprit. The test_radixtree/meson.build is the sole extension that explicitly specifies a link with pgport_srv. I think we can get rid of it as I've also confirmed the build still fine even without it. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-06 Thread Masahiko Sawada
On Thu, Mar 7, 2024 at 4:21 PM John Naylor wrote: > > On Thu, Mar 7, 2024 at 2:14 PM Masahiko Sawada wrote: > > > > On Thu, Mar 7, 2024 at 4:01 PM John Naylor wrote: > > > > > > On Thu, Mar 7, 2024 at 1:27 PM Masahiko Sawada > > > wrote: > &

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-06 Thread Masahiko Sawada
On Thu, Mar 7, 2024 at 4:01 PM John Naylor wrote: > > On Thu, Mar 7, 2024 at 1:27 PM Masahiko Sawada wrote: > > > > On Thu, Mar 7, 2024 at 3:20 PM John Naylor wrote: > > > > > > On Thu, Mar 7, 2024 at 12:59 PM John Naylor > > > wrote: > &

Re: Add new error_action COPY ON_ERROR "log"

2024-03-06 Thread Masahiko Sawada
levels for example to get actual soft error contents. One question I have is; do we want to write multiple NOTICE messages for one row if the row has malformed data on some columns? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-06 Thread Masahiko Sawada
On Thu, Mar 7, 2024 at 3:27 PM Masahiko Sawada wrote: > > On Thu, Mar 7, 2024 at 3:20 PM John Naylor wrote: > > > > > > In addition, olingo and grassquit are showing different kinds of > > "AddressSanitizer: odr-violation" errors, which I'm not sure what t

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-06 Thread Masahiko Sawada
On Thu, Mar 7, 2024 at 3:20 PM John Naylor wrote: > > On Thu, Mar 7, 2024 at 12:59 PM John Naylor wrote: > > > > On Thu, Mar 7, 2024 at 12:55 PM John Naylor wrote: > > > > > > On Wed, Mar 6, 2024 at 6:59 PM Masahiko Sawada > > > wrote: > > &

Re: Synchronizing slots from primary to standby

2024-03-06 Thread Masahiko Sawada
On Wed, Mar 6, 2024 at 5:53 PM Amit Kapila wrote: > > On Wed, Mar 6, 2024 at 12:07 PM Masahiko Sawada wrote: > > > > On Fri, Mar 1, 2024 at 3:22 PM Peter Smith wrote: > > > > > > On Fri, Mar 1, 2024 at 5

Re: Improve eviction algorithm in ReorderBuffer

2024-03-06 Thread Masahiko Sawada
ryheap.h > > 12. > +/* > + * Struct for A hash table element to store the node's index in the bh_nodes > + * array. > + */ > +typedef struct bh_nodeidx_entry > > /for A hash table/for a hash table/ > > ~~~ > > 13. > +/* define parameters necessary to generate the hash table interface */ > > Suggest uppercase "Define" and add a period. Fixed. > > ~~~ > > 14. > + > + /* > + * If bh_indexed is true, the bh_nodeidx is used to track of each node's > + * index in bh_nodes. This enables the caller to perform > + * binaryheap_remove_node_ptr(), binaryheap_update_up/down in O(log n). > + */ > + bool bh_indexed; > + bh_nodeidx_hash *bh_nodeidx; > } binaryheap; > > I'm wondering why the separate 'bh_indexed' is necessary at all. Can't > you just use the bh_nodeidx value? E.g. If bh_nodeidx == NULL then it > means there is no index tracking, otherwise there is. > Good point. I added a macro binaryheap_indexed() to check it for better readability. The above comments are incorporated into the latest v8 patch set that I've just submitted[1]. Regards, [1] https://www.postgresql.org/message-id/CAD21AoBYjJmz7q_%3DZ%2BeXJgm0FScyu3_iGFshPAvnq78B2KL3qQ%40mail.gmail.com -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Improve eviction algorithm in ReorderBuffer

2024-03-06 Thread Masahiko Sawada
On Tue, Mar 5, 2024 at 12:20 PM vignesh C wrote: > > On Wed, 28 Feb 2024 at 11:40, Amit Kapila wrote: > > > > On Mon, Feb 26, 2024 at 7:54 PM Masahiko Sawada > > wrote: > > > > > > > A few comments on 0003: > > === > >

Re: Improve eviction algorithm in ReorderBuffer

2024-03-06 Thread Masahiko Sawada
gt; anything because the caller does the check whether we need more space. > All that happens here is allocating more space. Maybe this function > comment should say something like "Double the space allocated for > nodes." Agreed with the above two points. I'll fix them in the next version patch. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-06 Thread Masahiko Sawada
On Wed, Mar 6, 2024 at 8:20 PM John Naylor wrote: > > On Tue, Mar 5, 2024 at 11:12 PM Masahiko Sawada wrote: > > > > > I'd like to push 0001 and 0002 shortly, and then do another sweep over > > > 0003, with remaining feedback, and get that in so we get some

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-06 Thread Masahiko Sawada
akes clear that the handle should be castable to dsa_pointer and it's a control object. I borrowed it from dshash_attach(). Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-06 Thread Masahiko Sawada
On Wed, Mar 6, 2024 at 5:33 PM John Naylor wrote: > > On Wed, Mar 6, 2024 at 3:02 PM Masahiko Sawada wrote: > > > > ../../src/include/port/simd.h:326:71: error: incompatible type for > > argument 1 of \342\200\230vshrq_n_s8\342\200\231 > > uint8x16_t m

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-06 Thread Masahiko Sawada
d = vandq_u8(vld1q_u8(mask), (uint8x16_t) vshrq_n_s8(v, 7)); ^ Since 'v' is uint8x16_t I think we should have used vshrq_n_u8() instead. Regard, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-05 Thread Masahiko Sawada
On Wed, Mar 6, 2024 at 12:59 PM John Naylor wrote: > > On Tue, Mar 5, 2024 at 11:12 PM Masahiko Sawada wrote: > > > > On Tue, Mar 5, 2024 at 6:41 PM John Naylor wrote: > > > > Done in v66-0009. I'd be curious to hear any feedback. I like the > > > a

Re: Synchronizing slots from primary to standby

2024-03-05 Thread Masahiko Sawada
On Fri, Mar 1, 2024 at 3:22 PM Peter Smith wrote: > > On Fri, Mar 1, 2024 at 5:11 PM Masahiko Sawada wrote: > > > ... > > +/* > > + * "*" is not accepted as in that case primary will not be able to > > know > > + * fo

Re: Synchronizing slots from primary to standby

2024-03-05 Thread Masahiko Sawada
On Wed, Mar 6, 2024 at 12:47 PM Amit Kapila wrote: > > On Wed, Mar 6, 2024 at 7:36 AM Masahiko Sawada wrote: > > > > On Tue, Mar 5, 2024 at 4:21 PM Zhijie Hou (Fujitsu) > > wrote: > > > > I have one question about PhysicalWakeupLogicalWalSnd(): > > >

Re: Synchronizing slots from primary to standby

2024-03-05 Thread Masahiko Sawada
adcast(>wal_confirm_rcv_cv); +return; +} +} +} IIUC walsender calls this function every time after updating the slot's restart_lsn, which could be very frequently. I'm concerned that it could be expensive to do a linear search on the standby_slot_names list every time. Is it possible to cache the information in walsender local somehow? For example, the walsender sets a flag in WalSnd after processing the config file if its slot name is present in standby_slot_names. That way, they can wake up logical walsenders if eligible after updating the slot's restart_lsn, without checking the standby_slot_names value. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Synchronizing slots from primary to standby

2024-03-05 Thread Masahiko Sawada
On Fri, Mar 1, 2024 at 4:21 PM Zhijie Hou (Fujitsu) wrote: > > On Friday, March 1, 2024 2:11 PM Masahiko Sawada > wrote: > > > > > > --- > > +void > > +assign_standby_slot_names(const char *newval, void *extra) { > > +List *sta

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-05 Thread Masahiko Sawada
On Tue, Mar 5, 2024 at 6:41 PM John Naylor wrote: > > On Tue, Feb 6, 2024 at 9:58 AM Masahiko Sawada wrote: > > > > On Fri, Feb 2, 2024 at 8:47 PM John Naylor wrote: > > > > It's pretty hard to see what test_pattern() is doing, or why it's > > > useful.

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-04 Thread Masahiko Sawada
On Mon, Mar 4, 2024 at 8:48 PM John Naylor wrote: > > On Mon, Mar 4, 2024 at 1:05 PM Masahiko Sawada wrote: > > > > On Sun, Mar 3, 2024 at 2:43 PM John Naylor wrote: > > > > Right, I should have said "reset". Resetting a context will delete > > >

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-03 Thread Masahiko Sawada
On Sun, Mar 3, 2024 at 2:43 PM John Naylor wrote: > > On Fri, Mar 1, 2024 at 3:01 PM Masahiko Sawada wrote: > > > > On Thu, Feb 29, 2024 at 8:43 PM John Naylor wrote: > > > > + ts->rt_context = AllocSetContextCreate(CurrentMemoryContext, > > > +

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-03-01 Thread Masahiko Sawada
On Thu, Feb 29, 2024 at 8:43 PM John Naylor wrote: > > On Tue, Feb 20, 2024 at 1:59 PM Masahiko Sawada wrote: > > > - v63-0008 patch fixes a bug in tidstore. > > - page->nwords = wordnum + 1; > - Assert(page->nwords = WORDS_PER_PAGE(offsets[num_offsets - 1]

Re: Synchronizing slots from primary to standby

2024-02-29 Thread Masahiko Sawada
hecked aside from validate_standby_slots()? I think that the doc doesn't mention anything about '*' and '*' cannot be used as a replication slot name. So even if we don't have this check, it might be no problem. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Making the initial and maximum DSA segment sizes configurable

2024-02-28 Thread Masahiko Sawada
t: > > * See dsa_create() for a note about the tranche arguments. > > which should probably reference dsa_create_extended() instead. Thanks, will fix it. Regards, [1] https://www.postgresql.org/message-id/CAFBsxsGiiyY%2BwykVLBbN9hFUMiNHqEr_Kqg9Mpc%3Duv4sg8eagQ%40mail.gmail.com -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Improve eviction algorithm in ReorderBuffer

2024-02-28 Thread Masahiko Sawada
On Wed, Feb 28, 2024 at 3:10 PM Amit Kapila wrote: > > On Mon, Feb 26, 2024 at 7:54 PM Masahiko Sawada wrote: > > > Thank you for the comments! > A few comments on 0003: > === > 1. > +/* > + * Threshold of the total number of top-level and su

Re: Improve eviction algorithm in ReorderBuffer

2024-02-26 Thread Masahiko Sawada
On Mon, Feb 26, 2024 at 6:43 PM Tomas Vondra wrote: > > > > On 2/26/24 07:46, Masahiko Sawada wrote: > > On Sat, Feb 24, 2024 at 1:29 AM Tomas Vondra > > wrote: > >>... > >> > >> overall design > >> -- > >> &g

Re: Improve eviction algorithm in ReorderBuffer

2024-02-25 Thread Masahiko Sawada
On Fri, Feb 23, 2024 at 6:24 PM vignesh C wrote: > > On Fri, 9 Feb 2024 at 20:51, Masahiko Sawada wrote: > > > > > > I think this performance regression is not acceptable. In this > > workload, one transaction has 10k subtransactions and the logical &

Re: Improve eviction algorithm in ReorderBuffer

2024-02-25 Thread Masahiko Sawada
e we could log that as a WARNING, similarly > to checkpoints - there we only log "checkpoints too frequent, tune WAL > limits", but perhaps we might do more here? Or maybe we could add the > watermark to the system catalog? Interesting ideas. The statistics such as spill_count shown

Re: Synchronizing slots from primary to standby

2024-02-20 Thread Masahiko Sawada
On Tue, Feb 20, 2024 at 12:44 PM Amit Kapila wrote: > > On Tue, Feb 20, 2024 at 8:25 AM Masahiko Sawada wrote: > > > > Some comments not related to the patch but to the existing code: > > > > --- > > It might have already been discussed but is the > >

Re: Synchronizing slots from primary to standby

2024-02-20 Thread Masahiko Sawada
On Tue, Feb 20, 2024 at 12:33 PM shveta malik wrote: > > On Tue, Feb 20, 2024 at 8:25 AM Masahiko Sawada wrote: > > > > > > I've reviewed the v91 patch. Here are random comments: > > Thanks for the comments. > > > --- > > /* > > * Check

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-02-19 Thread Masahiko Sawada
On Mon, Feb 19, 2024 at 7:47 PM John Naylor wrote: > > On Mon, Feb 19, 2024 at 9:02 AM Masahiko Sawada wrote: > > > > I think that vacuum and tidbitmap (and future users) would end up > > having the same max block size calculation. And it seems slightly odd > > laye

Re: Synchronizing slots from primary to standby

2024-02-19 Thread Masahiko Sawada
tch slots with failover enabled. */ appendStringInfo(, "SELECT slot_name, plugin, confirmed_flush_lsn," " restart_lsn, catalog_xmin, two_phase, failover," " database, conflict_reason" " FROM pg_catalog.pg_replication_slots" " WHERE failover and NOT temporary"); /* Execute the query */ res = walrcv_exec(wrconn, s.data, SLOTSYNC_COLUMN_COUNT, slotRow); pfree(s.data); We don't need 's' as the query is constant. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-02-18 Thread Masahiko Sawada
On Fri, Feb 16, 2024 at 12:41 PM John Naylor wrote: > > On Fri, Feb 16, 2024 at 10:05 AM Masahiko Sawada > wrote: > > > v61-0007: Runtime-embeddable tids -- Optional for v17, but should > > > reduce memory regressions, so should be considered. Up to 3 tids can > &

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-02-15 Thread Masahiko Sawada
On Thu, Feb 15, 2024 at 8:26 PM John Naylor wrote: > > On Thu, Feb 15, 2024 at 10:21 AM Masahiko Sawada > wrote: > > > > On Sat, Feb 10, 2024 at 9:29 PM John Naylor wrote: > > > I've also run the same scripts in my environment just in case and got > > sim

Re: Skip collecting decoded changes of already-aborted transactions

2024-02-14 Thread Masahiko Sawada
On Fri, Feb 2, 2024 at 12:48 AM vignesh C wrote: > > On Tue, 3 Oct 2023 at 15:54, vignesh C wrote: > > > > On Mon, 3 Jul 2023 at 07:16, Masahiko Sawada wrote: > > > > > > On Fri, Jun 23, 2023 at 12:39 PM Dilip Kumar > > > wrote: > > > >

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-02-14 Thread Masahiko Sawada
On Sat, Feb 10, 2024 at 9:29 PM John Naylor wrote: > > On Tue, Feb 6, 2024 at 9:58 AM Masahiko Sawada wrote: > > > > On Fri, Feb 2, 2024 at 8:47 PM John Naylor wrote: > > > > My todo: > > > - benchmark tid store / vacuum again, since we haven't since varl

Re: Synchronizing slots from primary to standby

2024-02-10 Thread Masahiko Sawada
On Fri, Feb 9, 2024 at 4:08 PM Zhijie Hou (Fujitsu) wrote: > > On Friday, February 9, 2024 2:44 PM Masahiko Sawada > wrote: > > > > On Thu, Feb 8, 2024 at 8:01 PM shveta malik wrote: > > > > > > On Thu, Feb 8, 2024 at 12:08 PM Peter Smith > >

Re: Improve eviction algorithm in ReorderBuffer

2024-02-09 Thread Masahiko Sawada
On Fri, Feb 9, 2024 at 7:35 PM Ajin Cherian wrote: > > > > On Tue, Feb 6, 2024 at 5:06 PM Masahiko Sawada wrote: >> >> >> I've attached the new version patch set. >> >> Regards, >> >> >> -- >> Masahiko Sawada >> Amazon Web

Re: Improve eviction algorithm in ReorderBuffer

2024-02-09 Thread Masahiko Sawada
00k tuples (normal.sql): * without spill HEAD: 13235.136 ms v3 patch: 14320.082 ms v4 patch: 13300.665 ms * with spill HEAD: 22970.204 ms v3 patch: 23625.649 ms v4 patch: 23304.366 workload-2, decode one transaction with 100k subtransaction (many-subtxn.sql): * without spill HEAD: 345.718 ms v3

Re: Synchronizing slots from primary to standby

2024-02-08 Thread Masahiko Sawada
ame, "primary_slot_name")); + I think that the detail message is not appropriate since the primary_slot_name could actually be a valid name. I think we can rephrase it to something like "The replication slot %s specified by %s does not exist on the primary server". Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Testing autovacuum wraparound (including failsafe)

2024-02-08 Thread Masahiko Sawada
On Thu, Feb 8, 2024 at 4:06 PM Peter Eisentraut wrote: > > On 08.02.24 05:05, Masahiko Sawada wrote: > > On Thu, Feb 8, 2024 at 3:11 AM Peter Eisentraut > > wrote: > >> > >> The way src/test/modules/xid_wraparound/meson.build is written, it > &

Re: Testing autovacuum wraparound (including failsafe)

2024-02-07 Thread Masahiko Sawada
ng test modules such as > src/test/modules/test_rbtree/meson.build for examples. > Good catch, thanks. I've attached the patch to fix it. Does it make sense? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com 0001-Prevent-installation-of-xid_wraparound-test-durin

Re: Synchronizing slots from primary to standby

2024-02-06 Thread Masahiko Sawada
On Tue, Feb 6, 2024 at 8:21 PM Amit Kapila wrote: > > On Tue, Feb 6, 2024 at 3:33 PM Amit Kapila wrote: > > > > On Tue, Feb 6, 2024 at 1:09 PM Masahiko Sawada > > wrote: > > > > > > On Tue, Feb 6, 2024 at 3:19 PM Amit Kapila > > > wrote: >

Re: Synchronizing slots from primary to standby

2024-02-05 Thread Masahiko Sawada
On Tue, Feb 6, 2024 at 3:19 PM Amit Kapila wrote: > > On Mon, Feb 5, 2024 at 7:56 PM Masahiko Sawada wrote: > > > > --- > > Since Two processes (e.g. the slotsync worker and > > pg_sync_replication_slots()) concurrently fetch and update the slot > > informat

Re: Improve eviction algorithm in ReorderBuffer

2024-02-05 Thread Masahiko Sawada
On Fri, Feb 2, 2024 at 5:16 PM Masahiko Sawada wrote: > > On Fri, Feb 2, 2024 at 1:59 PM Shubham Khanna > wrote: > > > > On Fri, Jan 26, 2024 at 2:07 PM Masahiko Sawada > > wrote: > > > > > > On Wed, Dec 20, 2023 at 12:11 PM Amit Kapila > >

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-02-05 Thread Masahiko Sawada
On Fri, Feb 2, 2024 at 8:47 PM John Naylor wrote: > > On Wed, Jan 31, 2024 at 12:50 PM Masahiko Sawada > wrote: > > I've attached the new patch set (v56). I've squashed previous updates > > and addressed review comments on v55 in separate patches. Here are the > > u

Re: Synchronizing slots from primary to standby

2024-02-05 Thread Masahiko Sawada
we use CONCAT function, we can replace '||' with ','. --- + Confirm that the standby server is not lagging behind the subscribers. + This step can be skipped if + standby_slot_names + has been correctly configured. How can the user confirm if standby_slot_names is correctly configured? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: meson: catalog/syscache_ids.h isn't installed

2024-02-04 Thread Masahiko Sawada
g', >dir_include_server / 'catalog', >dir_include_server / 'catalog', > ] > > Thank you for reporting the issue and the patch. I've confirmed this patch fixes the issue. But I don't have enough knowledge of meson to assess this fix. Peter, could you check this fix as

Re: Improve eviction algorithm in ReorderBuffer

2024-02-02 Thread Masahiko Sawada
On Fri, Feb 2, 2024 at 1:59 PM Shubham Khanna wrote: > > On Fri, Jan 26, 2024 at 2:07 PM Masahiko Sawada wrote: > > > > On Wed, Dec 20, 2023 at 12:11 PM Amit Kapila > > wrote: > > > > > > On Wed, Dec 20, 2023 at 6:49 AM Masahiko Sawada > > &g

Re: Improve eviction algorithm in ReorderBuffer

2024-02-01 Thread Masahiko Sawada
Hi, On Wed, Jan 31, 2024 at 5:32 PM vignesh C wrote: > > On Tue, 30 Jan 2024 at 13:37, Masahiko Sawada wrote: > > > > On Fri, Jan 26, 2024 at 5:36 PM Masahiko Sawada > > wrote: > > > > > > On Wed, Dec 20, 2023 at 12:11 PM Amit Kapila > > >

Re: Commitfest 2024-01 is now closed

2024-02-01 Thread Masahiko Sawada
ted > 2022: 58 committed > 2021: 56 committed > 2020: 49 committed > > A special thanks to the reviewers/committers who spent tireless > effort in moving the patches forward. > Thank you for all the hard work, Vignesh! Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Improve eviction algorithm in ReorderBuffer

2024-02-01 Thread Masahiko Sawada
small amount of > changes, the performance may be degraded, right? Do you have a result in sucha > a case? I've run a benchmark test that I shared before[1]. Here are results of decoding a transaction that has 1M subtransaction each of which has 1 INSERT: HEAD: 1810.192 ms HEAD w/ patch: 2001.094 ms I set a large enough value to logical_decoding_work_mem not to evict any transactions. I can see about about 10% performance regression in this case. Regards, [1] https://www.postgresql.org/message-id/CAD21AoAfKTgrBrLq96GcTv9d6k97zaQcDM-rxfKEt4GSe0qnaQ%40mail.gmail.com -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Synchronizing slots from primary to standby

2024-02-01 Thread Masahiko Sawada
On Fri, Feb 2, 2024 at 1:58 PM Amit Kapila wrote: > > On Fri, Feb 2, 2024 at 6:46 AM Masahiko Sawada wrote: > > > > On Thu, Feb 1, 2024 at 12:51 PM Amit Kapila wrote: > > > > > > > > > > BTW I've tested the following switch/fail-back scenario but

Re: Synchronizing slots from primary to standby

2024-02-01 Thread Masahiko Sawada
On Thu, Feb 1, 2024 at 12:51 PM Amit Kapila wrote: > > On Wed, Jan 31, 2024 at 9:20 PM Masahiko Sawada wrote: > > > > On Wed, Jan 31, 2024 at 7:42 PM Amit Kapila wrote: > > > > > > > > > Considering my previous where we don't want to restart

Re: Synchronizing slots from primary to standby

2024-01-31 Thread Masahiko Sawada
On Wed, Jan 31, 2024 at 7:42 PM Amit Kapila wrote: > > On Wed, Jan 31, 2024 at 2:02 PM Masahiko Sawada wrote: > > > > Thank you for updating the patches. As for the slotsync worker patch, > > is there any reason why 0001, 0002, and 0004 patches are still > > separat

Re: Synchronizing slots from primary to standby

2024-01-31 Thread Masahiko Sawada
replication slot "s" is active for PID 1103935 2024-01-31 17:25:21.750 JST [1103933] CONTEXT: WAL redo at 0/3020D20 for Database/DROP: dir 1663/16384 2024-01-31 17:25:21.751 JST [1103930] LOG: startup process (PID 1103933) exited with exit code 1 It seems that because the slo

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-30 Thread Masahiko Sawada
On Tue, Jan 30, 2024 at 7:20 PM John Naylor wrote: > > On Tue, Jan 30, 2024 at 7:56 AM Masahiko Sawada wrote: > > > > On Mon, Jan 29, 2024 at 8:48 PM John Naylor wrote: > > > > I meant the macro could probably be > > > > > > Max(SLAB_DEFAULT_BLO

Re: Question on LWLockMode in dsa.c

2024-01-30 Thread Masahiko Sawada
On Tue, Jan 30, 2024 at 4:43 PM Bharath Rupireddy wrote: > > On Tue, Jan 30, 2024 at 6:24 AM Masahiko Sawada wrote: > > > > Hi, > > > > While working on radix tree patch[1], John Naylor found that dsa.c > > doesn't already use shared locks even in dsa_dump

Re: Improve eviction algorithm in ReorderBuffer

2024-01-30 Thread Masahiko Sawada
On Fri, Jan 26, 2024 at 5:36 PM Masahiko Sawada wrote: > > On Wed, Dec 20, 2023 at 12:11 PM Amit Kapila wrote: > > > > On Wed, Dec 20, 2023 at 6:49 AM Masahiko Sawada > > wrote: > > > > > > On Tue, Dec 19, 2023 at 8:02 PM Amit Kapila > > >

Re: Make COPY format extendable: Extract COPY TO format implementations

2024-01-29 Thread Masahiko Sawada
t | N attributes| Attr1's format |...| AttrN's format | + * ++++++ +++ + * 0: text 0: text 0: text + * 1: binary1: binary 1: binary + */ I think this kind of diagram could be missed from being updated when we update the CopyOutResponse format. It's better to refer to the documentation instead. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-29 Thread Masahiko Sawada
On Mon, Jan 29, 2024 at 8:48 PM John Naylor wrote: > > On Mon, Jan 29, 2024 at 2:29 PM Masahiko Sawada wrote: > > > > > +/* > > > > + * Calculate the slab blocksize so that we can allocate at least 32 > > > > chunks > > > > + * from th

Question on LWLockMode in dsa.c

2024-01-29 Thread Masahiko Sawada
-TRD62BTwom8iLXLOWMsHkkwFi%3Drzg%40mail.gmail.com -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-28 Thread Masahiko Sawada
On Fri, Jan 26, 2024 at 11:05 PM Masahiko Sawada wrote: > > On Wed, Jan 24, 2024 at 3:42 PM John Naylor wrote: > > > > On Tue, Jan 23, 2024 at 10:58 AM Masahiko Sawada > > wrote: > > > > > > The new patches probably need to be polished but the V

Re: Make COPY format extendable: Extract COPY TO format implementations

2024-01-28 Thread Masahiko Sawada
On Mon, Jan 29, 2024 at 12:10 PM Junwang Zhao wrote: > > On Mon, Jan 29, 2024 at 10:42 AM Masahiko Sawada > wrote: > > > > On Fri, Jan 26, 2024 at 6:02 PM Junwang Zhao wrote: > > > > > > On Fri, Jan 26, 2024 at 4:55 PM Sutou Kouhei wrote: > > >

Re: Make COPY format extendable: Extract COPY TO format implementations

2024-01-28 Thread Masahiko Sawada
false if the passed option is not supported. If one of the builtin formats is specified and the rest options list has at least one option, we raise "option %s not recognized" error. IOW it's the core's responsibility to ranse the "option %s not recognized" error, which is in order to raise a consistent error message. Also, I think the core should check the redundant options including bultiin and custom options. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Remove unused fields in ReorderBufferTupleBuf

2024-01-28 Thread Masahiko Sawada
On Fri, Jan 26, 2024 at 4:04 PM Masahiko Sawada wrote: > > On Thu, Jan 25, 2024 at 10:17 PM Aleksander Alekseev > wrote: > > > > Hi, > > > > > > Here is the corrected patch. > > > > > > Thank you for updating the p

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-26 Thread Masahiko Sawada
On Wed, Jan 24, 2024 at 3:42 PM John Naylor wrote: > > On Tue, Jan 23, 2024 at 10:58 AM Masahiko Sawada > wrote: > > > > The new patches probably need to be polished but the VacDeadItemInfo > > idea looks good to me. > > That idea looks good to me, too. S

Re: Improve eviction algorithm in ReorderBuffer

2024-01-26 Thread Masahiko Sawada
On Wed, Dec 20, 2023 at 12:11 PM Amit Kapila wrote: > > On Wed, Dec 20, 2023 at 6:49 AM Masahiko Sawada wrote: > > > > On Tue, Dec 19, 2023 at 8:02 PM Amit Kapila wrote: > > > > > > On Tue, Dec 19, 2023 at 8:31 AM Masahiko Sawada > > > wrote: >

Re: Remove unused fields in ReorderBufferTupleBuf

2024-01-25 Thread Masahiko Sawada
-pfree(tuple); > > -} > > - > > > > Why does ReorderBufferReturnTupleBuf need to be moved from > > reorderbuffer.c to reorderbuffer.h? It seems not related to this > > refactoring patch so I think we should do it in a separate patch if we > > really want it. I'm not sure it's necessary, though. > > OK, fixed. Thank you for updating the patch. It looks good to me. I'm going to push it next week, barring any objections. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Small fix on COPY ON_ERROR document

2024-01-25 Thread Masahiko Sawada
On Fri, Jan 26, 2024 at 2:40 PM Yugo NAGATA wrote: > > On Fri, 26 Jan 2024 13:59:09 +0900 > Masahiko Sawada wrote: > > > On Fri, Jan 26, 2024 at 11:28 AM Yugo NAGATA wrote: > > > > > > Hi, > > > > > > I found that the documentation of COPY

Re: Small fix on COPY ON_ERROR document

2024-01-25 Thread Masahiko Sawada
+This should not lead to problems in the event of a COPY How about the followings for consistency with the description of the ON_ERROR option? COPY stops operation at the first error if the stop value is specified to the ON_ERROR option. This should not lead to ... Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Remove unused fields in ReorderBufferTupleBuf

2024-01-25 Thread Masahiko Sawada
er > read. > Lines 3806, 3836, 3854, 3889, 3910 > > I can create patch and post it to this thread or a new one if deemed > worthwhile. I'm not sure these changes are really beneficial. They contribute to improving neither readability and performance IMO. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Add tuples_skipped to pg_stat_progress_copy

2024-01-24 Thread Masahiko Sawada
On Thu, Jan 25, 2024 at 11:25 AM torikoshia wrote: > > On 2024-01-24 17:05, Masahiko Sawada wrote: > > On Tue, Jan 23, 2024 at 1:02 AM torikoshia > > wrote: > >> > >> On 2024-01-17 14:47, Masahiko Sawada wrote: > >> > On Wed, Jan 17, 2024 at 2:22

Re: Make COPY format extendable: Extract COPY TO format implementations

2024-01-24 Thread Masahiko Sawada
On Thu, Jan 25, 2024 at 1:53 PM Michael Paquier wrote: > > On Thu, Jan 25, 2024 at 01:36:03PM +0900, Masahiko Sawada wrote: > > Hmm I can see a similar trend that Suto-san had; the binary format got > > slightly faster whereas both text and csv format has small regression &g

Re: Make COPY format extendable: Extract COPY TO format implementations

2024-01-24 Thread Masahiko Sawada
if (cstate->opts.binary)" branches from the original CopyOneRowTo(). I've experimented with a similar optimization for csv and text format; have different callbacks for text and csv format and remove "if (cstate->opts.csv_mode)" branches. I've attached a patch for that. Here are results: HEAD w/ 0001 patch + remove branches: binary 2824.502 ms text 2715.264 ms csv 2803.381 ms The numbers look better now. I'm not sure these are within a noise range but it might be worth considering having different callbacks for text and csv formats. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com add_callback_for_csv_format.patch Description: Binary data

Re: Remove unused fields in ReorderBufferTupleBuf

2024-01-24 Thread Masahiko Sawada
oved from reorderbuffer.c to reorderbuffer.h? It seems not related to this refactoring patch so I think we should do it in a separate patch if we really want it. I'm not sure it's necessary, though. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Add tuples_skipped to pg_stat_progress_copy

2024-01-24 Thread Masahiko Sawada
On Tue, Jan 23, 2024 at 1:02 AM torikoshia wrote: > > On 2024-01-17 14:47, Masahiko Sawada wrote: > > On Wed, Jan 17, 2024 at 2:22 PM torikoshia > > wrote: > >> > >> Hi, > >> > >> 132de9968840c introduced SAVE_ERROR_TO option to COPY and en

Re: Synchronizing slots from primary to standby

2024-01-23 Thread Masahiko Sawada
On Wed, Jan 24, 2024 at 2:43 PM Amit Kapila wrote: > > On Wed, Jan 24, 2024 at 10:41 AM Masahiko Sawada > wrote: > > > > On Mon, Jan 22, 2024 at 3:58 PM Amit Kapila wrote: > > > > > > Can we think of using GetStandbyFlushRecPtr()? We probably need to &g

Re: Synchronizing slots from primary to standby

2024-01-23 Thread Masahiko Sawada
On Mon, Jan 22, 2024 at 3:58 PM Amit Kapila wrote: > > On Fri, Jan 19, 2024 at 3:55 PM shveta malik wrote: > > > > On Fri, Jan 19, 2024 at 10:35 AM Masahiko Sawada > > wrote: > > > > > > > > > Thank you for updating the patch. I have some co

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-22 Thread Masahiko Sawada
On Tue, Jan 23, 2024 at 12:58 PM Masahiko Sawada wrote: > > On Mon, Jan 22, 2024 at 5:18 PM John Naylor wrote: > > > > On Mon, Jan 22, 2024 at 2:24 PM Masahiko Sawada > > wrote: > > > > > > For the next version patch, I'll work on this idea an

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-22 Thread Masahiko Sawada
On Mon, Jan 22, 2024 at 5:18 PM John Naylor wrote: > > On Mon, Jan 22, 2024 at 2:24 PM Masahiko Sawada wrote: > > > > For the next version patch, I'll work on this idea and try to clean up > > locking stuff both in tidstore and radix tree. Or if you're already > > w

Re: Synchronizing slots from primary to standby

2024-01-22 Thread Masahiko Sawada
On Mon, Jan 22, 2024 at 9:26 PM Amit Kapila wrote: > > On Mon, Jan 22, 2024 at 5:28 PM Masahiko Sawada wrote: > > > > On Sat, Jan 20, 2024 at 7:44 PM Amit Kapila wrote: > > > > > > On Sat, Jan 20, 2024 at 10:52 AM Dilip Kumar > > > wrote: > &g

Re: Synchronizing slots from primary to standby

2024-01-22 Thread Masahiko Sawada
bout filtering slots on the standby side? That is, for example, the LIST_SLOT command returns all slots and the slotsync worker filters out non-failover slots. Also such command could potentially be used also in client tools like pg_basebackup, pg_receivewal, and pg_recvlogical to list the available replication slots to specify. > > > Considering all this it seems that for now probably extending > > > replication commands can simplify a few things like mentioned above > > > but using SQL's with db-connection is more extendable. > > Agreed. Having said that, considering Amit, Bertrand, and Dilip already agreed with the current design (using SQL's with db-connection), I might be worrying too much. So we can probably go with the current design and improve it if we find some problems. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-21 Thread Masahiko Sawada
On Mon, Jan 22, 2024 at 2:36 PM John Naylor wrote: > > On Mon, Jan 22, 2024 at 10:28 AM Masahiko Sawada > wrote: > > > > On further thought, as you pointed out before, "num_tids" should not > > be in tidstore in terms of integration with tidbitmap.c, bec

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-21 Thread Masahiko Sawada
of polish, but > wanted to get it out there anyway. Cool. I'll merge these patches in the next version v54 patch set. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-21 Thread Masahiko Sawada
On Fri, Jan 19, 2024 at 6:48 PM John Naylor wrote: > > On Fri, Jan 19, 2024 at 2:26 PM Masahiko Sawada wrote: > > > > On Thu, Jan 18, 2024 at 1:30 PM John Naylor wrote: > > > I'm not quite sure what the point of "num_items" is anymore, because

Re: subscription disable_on_error not working after ALTER SUBSCRIPTION set bad conninfo

2024-01-19 Thread Masahiko Sawada
On Thu, Jan 18, 2024 at 6:54 PM Amit Kapila wrote: > > On Thu, Jan 18, 2024 at 11:15 AM Peter Smith wrote: > > > > On Thu, Jan 18, 2024 at 12:55 PM Masahiko Sawada > > wrote: > > > > > ... > > > > > > Although we can improve it to han

Re: Emitting JSON to file using COPY TO

2024-01-19 Thread Masahiko Sawada
item: { $$ = makeDefElem("encoding", (Node *) makeString($2), @1); } + | FORCE ARRAY + { + $$ = makeDefElem("force_array", (Node *) makeBoolean(true), @1); + } ; I believe we don't need to support new options in old-style syntax. --- @@ -3469,6 +3477,10 @@ copy_generic_opt_elem: { $$ = makeDefElem($1, $2, @1); } + | FORMAT_LA copy_generic_opt_arg + { + $$ = makeDefElem("format", $2, @1); + } ; I think it's not necessary. "format" option is already handled in copy_generic_opt_elem. --- +/* need delimiter to start next json array element */ +static bool json_row_delim_needed = false; I think it's cleaner to include json_row_delim_needed into CopyToStateData. --- Splitting the patch into two patches: add json format and add force_array option would make reviews easy. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-18 Thread Masahiko Sawada
On Thu, Jan 18, 2024 at 1:30 PM John Naylor wrote: > > On Thu, Jan 18, 2024 at 8:31 AM Masahiko Sawada wrote: > > It seems we cannot make this work nicely. IIUC VacDeadItems is > > allocated in DSM and TidStore is embedded there. However, > > dead_items->items.area is

Re: Synchronizing slots from primary to standby

2024-01-18 Thread Masahiko Sawada
" LSN %X/%X for slot \"%s\" is ahead of the standby position %X/%X", + LSN_FORMAT_ARGS(remote_slot->confirmed_lsn), + remote_slot->name, + LSN_FORMAT_ARGS(latestWalEnd)); +} IIUC GetWalRcvLatestWalEnd () returns walrcv->latestWalEnd, which is typically the primary server's flush position and doesn't mean the LSN where the walreceiver received/flushed up to. Does it really happen that the slot's confirmed_flush_lsn is higher than the primary's flush lsn? --- After dropping a database on the primary, I got the following LOG (PID 2978463 is the slotsync worker on the standby): LOG: still waiting for backend with PID 2978463 to accept ProcSignalBarrier CONTEXT: WAL redo at 0/301CE00 for Database/DROP: dir 1663/16384 Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2024-01-18 Thread Masahiko Sawada
On Thu, Jan 18, 2024 at 4:59 PM Alexander Korotkov wrote: > > On Thu, Jan 18, 2024 at 4:16 AM torikoshia wrote: > > On 2024-01-18 10:10, jian he wrote: > > > On Thu, Jan 18, 2024 at 8:57 AM Masahiko Sawada > > > wrote: > > >> On Thu, Jan 18, 2024 at

Re: subscription disable_on_error not working after ALTER SUBSCRIPTION set bad conninfo

2024-01-17 Thread Masahiko Sawada
se too, I'm not sure it's a bug. The doc says[1]: Specifies whether the subscription should be automatically disabled if any errors are detected by subscription workers during data replication from the publisher. When an apply worker is trying to establish a connection, it's not replicating data fro

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-17 Thread Masahiko Sawada
On Wed, Jan 17, 2024 at 11:37 AM John Naylor wrote: > > On Wed, Jan 17, 2024 at 8:39 AM Masahiko Sawada wrote: > > > > On Wed, Jan 17, 2024 at 9:20 AM John Naylor wrote: > > > > > > On Tue, Jan 16, 2024 at 1:18 PM Masahiko Sawada > > > wrote:

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2024-01-17 Thread Masahiko Sawada
context seems impossible. I've been thinking we can add more values to this option to log errors not only to the server logs but also to the error table (not sure details but I imagined an error table is created for each table on error), without an additional option for the destination name. The values would be like error_action {error|ignore|save-logs|save-table}. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Add tuples_skipped to pg_stat_progress_copy

2024-01-16 Thread Masahiko Sawada
> > > What do you think? +1 The patch is pretty simple. Here is a comment: + (if SAVE_ERROR_TO is specified, otherwise zero). + + To be precise, this counter only advances when a value other than 'ERROR' is specified to SAVE_ERROR_TO option. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [PoC] Improve dead tuple storage for lazy vacuum

2024-01-16 Thread Masahiko Sawada
On Wed, Jan 17, 2024 at 9:20 AM John Naylor wrote: > > On Tue, Jan 16, 2024 at 1:18 PM Masahiko Sawada wrote: > > Just changing "items" to be the local tidstore struct could make the > > code tricky a bit, since max_bytes and num_items are on the shared > &g

Re: Synchronizing slots from primary to standby

2024-01-16 Thread Masahiko Sawada
On Tue, Jan 16, 2024 at 6:40 PM shveta malik wrote: > > On Tue, Jan 16, 2024 at 12:59 PM Masahiko Sawada > wrote: > > > > On Tue, Jan 16, 2024 at 1:07 PM Amit Kapila wrote: > > > > > > On Tue, Jan 16, 2024 at 9:03 AM shveta malik > > > wrote:

Re: Synchronizing slots from primary to standby

2024-01-15 Thread Masahiko Sawada
of the approaches but I still feel that when we > > have a standard way of doing things (bgworker) we should not keep > > adding code to do things in a special way unless there is a strong > > reason to do so. Now we need to decide if 'enable_syncslot' being > > PGC_POSTMASTER is a strong reason to go the non-standard way? > > > > Agreed and as said earlier I think it is better to make it a > PGC_SIGHUP. Also, not sure we can say it is a non-standard way as > already autovacuum launcher is handled in the same way. One more minor > thing is it will save us for having a new bgworker state > BgWorkerStart_ConsistentState_HotStandby as introduced by this patch. Why do we need to add a new BgWorkerStart_ConsistentState_HotStandby for the slotsync worker? Isn't it sufficient that the slotsync worker exits if not in hot standby mode? Is there any technical difficulty or obstacle to make the slotsync worker start using bgworker after reloading the config file? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

<    1   2   3   4   5   6   7   8   9   10   >