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

2024-02-01 Thread Junwang Zhao
extra > callbacks? > -- > Michael If V7 and V10 have no performance reduction, then I think V6 is also good with performance, since most of the time goes to CopyToOneRow and CopyFromOneRow. I just think we should take the *extendable* into consideration at the beginning. -- Regards Junwang Zhao

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

2024-01-31 Thread Junwang Zhao
On Thu, Feb 1, 2024 at 11:56 AM Michael Paquier wrote: > > On Thu, Feb 01, 2024 at 11:43:07AM +0800, Junwang Zhao wrote: > > The first 6 rounds are like 10% better than the later 9 rounds, is this > > normal? > > Even with HEAD? Perhaps you have some OS cache eviction i

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

2024-01-31 Thread Junwang Zhao
: 3704.367 ms (00:03.704) COPY 1000 Time: 3724.281 ms (00:03.724) COPY 1000 Time: 3703.335 ms (00:03.703) COPY 1000 Time: 3728.629 ms (00:03.729) COPY 1000 Time: 3758.135 ms (00:03.758) The first 6 rounds are like 10% better than the later 9 rounds, is this normal? -- Regards Junwang Zhao

Re: Emitting JSON to file using COPY TO

2024-01-31 Thread Junwang Zhao
Hi Vignesh, On Wed, Jan 31, 2024 at 5:50 PM vignesh C wrote: > > On Sat, 27 Jan 2024 at 11:25, Junwang Zhao wrote: > > > > Hi hackers, > > > > Kou-san(CCed) has been working on *Make COPY format extendable[1]*, so > > I think making *copy to json* b

Re: UUID v7

2024-01-30 Thread Junwang Zhao
ritten this phrase, hope it’s more clear now. > > > Best regards, Andrey Borodin. +Datum +uuid_extract_var(PG_FUNCTION_ARGS) +{ + pg_uuid_t *uuid = PG_GETARG_UUID_P(0); + uint16_t result; + result = uuid->data[8] >> 6; + + PG_RETURN_UINT16(result); +} \ No newline at end of file It's always good to add a newline at the end of a source file, though this might be nitpicky. -- Regards Junwang Zhao

Re: UUID v7

2024-01-29 Thread Junwang Zhao
; other > > versions and variants this function returns NULL. The extracted timestamp > > does not necessarily equate to the time of UUID generation. How close it is > > to the actual time depends on the implementation that generated to UUID. > > The uuidv7() function provided PostgreSQL will normally store the actual > > time of > > generation to in the UUID, but if large batches of UUIDs are generated at > > the > > same time it's possible that some UUIDs will store a time that is slightly > > later > > than their actual generation time. > > -- Regards Junwang Zhao

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

2024-01-28 Thread Junwang Zhao
On Mon, Jan 29, 2024 at 2:03 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Sat, 27 Jan 2024 14:15:02 +0800, > Junwang Zhao wrote: > > > I have been working on a *COPY TO JS

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

2024-01-28 Thread Junwang Zhao
On Mon, Jan 29, 2024 at 11:22 AM Masahiko Sawada wrote: > > 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: >

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

2024-01-28 Thread Junwang Zhao
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: > > > > > > Hi, > > > > > > In > > > "Re: Make C

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

2024-01-26 Thread Junwang Zhao
On Fri, Jan 26, 2024 at 4:55 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Fri, 26 Jan 2024 16:41:50 +0800, > Junwang Zhao wrote: > > > CopyToProcessOption()/CopyFromProcessOp

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

2024-01-26 Thread Junwang Zhao
On Fri, Jan 26, 2024 at 4:32 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Fri, 26 Jan 2024 16:18:14 +0800, > Junwang Zhao wrote: > > > In the current implementa

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

2024-01-26 Thread Junwang Zhao
san, In the current implementation, there is no way that one can check incompatibility options in ProcessCopyOptions, we can postpone the check in CopyFromStart or CopyToStart, but I think it is a little bit late. Do you think adding an extra check for incompatible options hook is acceptable (PFA)? -- Regards Junwang Zhao 0001-add-check-incomptiblity-options-hooks.patch Description: Binary data

Re: make dist using git archive

2024-01-22 Thread Junwang Zhao
On Tue, Jan 23, 2024 at 2:36 AM Peter Eisentraut wrote: > > On 22.01.24 13:10, Junwang Zhao wrote: > > I played this with meson build on macOS, the packages are generated > > in source root but not build root, I'm sure if this is by design but I think > > polluting *workin

Re: make dist using git archive

2024-01-22 Thread Junwang Zhao
ix postgresql-17devel/ HEAD -o postgresql-`git describe --tags`.tar.gz > > and it produces the same set of tarballs as before, except it's done > differently. > > The actual build scripts need some fine-tuning, but the general idea is > correct, I think. I think this is a good idea, thanks for working on this. -- Regards Junwang Zhao

Re: make pg_ctl more friendly

2024-01-17 Thread Junwang Zhao
g ;) > > -- > Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ > "Now I have my system running, not a byte was off the shelf; > It rarely breaks and when it does I fix the code myself. > It's stable, clean and elegant, and lightning fast as well, > And it doesn't cost a nickel, so Bill Gates can go to hell." -- Regards Junwang Zhao v5-0001-PITR-shutdown-should-not-report-error-by-pg_ctl.patch Description: Binary data

Re: make pg_ctl more friendly

2024-01-15 Thread Junwang Zhao
ps we could say "shut down while in recovery." Make sense. Fixed. See V4 > And maybe we should > point to the specific settings in the latter message. I've changed this latter message to: update recovery target settings for startup again if needed What do you think? > >

Re: speed up a logical replica setup

2024-01-13 Thread Junwang Zhao
What is *local logical replication*? I can't find any clue in the patch, can you give me some hint? > > -- > Euler Taveira > EDB https://www.enterprisedb.com/ > -- Regards Junwang Zhao

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

2024-01-11 Thread Junwang Zhao
Hi, On Wed, Jan 10, 2024 at 2:20 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Fri, 22 Dec 2023 10:58:05 +0800, > Junwang Zhao wrote: > > >> 1. Add an opaque space for custo

Re: make pg_ctl more friendly

2024-01-09 Thread Junwang Zhao
Hi Nazir, On Tue, Jan 9, 2024 at 9:23 PM Nazir Bilal Yavuz wrote: > > Hi, > > Thank you for working on this! I agree that the current message is not > friendly. > > On Thu, 9 Nov 2023 at 10:19, Junwang Zhao wrote: > > > > On Thu, Nov 9, 2023 at 3:08 PM Junwa

Re: Change GUC hashtable to use simplehash?

2024-01-07 Thread Junwang Zhao
ts/examples, > but I think it's mostly there. I'll return to it by next week. > > + * Portions Copyright (c) 2018-2023, PostgreSQL Global Development Group A kind reminder, it's already 2024 :) I'm also curious why the 2018, is there any convention for that? -- Regards Junwang Zhao

Re: Transaction timeout

2023-12-29 Thread Junwang Zhao
On Fri, Dec 29, 2023 at 6:00 PM Andrey M. Borodin wrote: > > > > > On 28 Dec 2023, at 21:02, Junwang Zhao wrote: > > > > Seems V5~V17 doesn't work as expected for Nikolay's case: > > > > Yeah, that's a problem. > > So I propose the following ch

Re: Transaction timeout

2023-12-28 Thread Junwang Zhao
enable_timeout_after(TRANSACTION_TIMEOUT, TransactionTimeout); xact_started = true; > > > Best regards, Andrey Borodin. -- Regards Junwang Zhao

Re: Proposal to include --exclude-extension Flag in pg_dump

2023-12-25 Thread Junwang Zhao
ns, does the following make sense to you? printf(_(" --enable-row-security enable row security (dump only content user has\n" "access to)\n")); + printf(_(" --exclude-extension=PATTERN do NOT dump the specified extension(s)\n")); printf(_(" --exclude-table-and-children=PATTERN\n" -- Regards Junwang Zhao

Re: Transaction timeout

2023-12-24 Thread Junwang Zhao
to disable other timeouts... Also, if we are already in transaction, > shouldn't we also subtract current transaction span from timeout? idle_in_transaction_session_timeout is already the behavior Japin suggested, it is enabled before backend sends *read for query* to client. > I think making this functionality as another step of the patchset was a good > idea. > > Thanks! > > > Best regards, Andrey Borodin. -- Regards Junwang Zhao

Re: Transaction timeout

2023-12-22 Thread Junwang Zhao
On Sat, Dec 23, 2023 at 11:17 AM Japin Li wrote: > > a > On Sat, 23 Dec 2023 at 10:40, Japin Li wrote: > > On Sat, 23 Dec 2023 at 08:32, Japin Li wrote: > >> On Fri, 22 Dec 2023 at 23:30, Junwang Zhao wrote: > >>> On Fri, Dec 22, 2023 at 10:44 PM Japin Li

Re: Transaction timeout

2023-12-22 Thread Junwang Zhao
On Sat, Dec 23, 2023 at 10:40 AM Japin Li wrote: > > > On Sat, 23 Dec 2023 at 08:32, Japin Li wrote: > > On Fri, 22 Dec 2023 at 23:30, Junwang Zhao wrote: > >> On Fri, Dec 22, 2023 at 10:44 PM Japin Li wrote: > >>> > >>> > >>> On Fr

Re: Transaction timeout

2023-12-22 Thread Junwang Zhao
On Fri, Dec 22, 2023 at 10:44 PM Japin Li wrote: > > > On Fri, 22 Dec 2023 at 22:37, Junwang Zhao wrote: > > On Fri, Dec 22, 2023 at 10:25 PM Japin Li wrote: > >> I try to set idle_in_transaction_session_timeout after begin transaction, > >> i

Re: Transaction timeout

2023-12-22 Thread Junwang Zhao
On Fri, Dec 22, 2023 at 10:25 PM Japin Li wrote: > > > On Fri, 22 Dec 2023 at 20:29, Junwang Zhao wrote: > > On Fri, Dec 22, 2023 at 1:39 PM Japin Li wrote: > >> > >> > >> On Tue, 19 Dec 2023 at 22:06, Japin Li wrote: > >> > On Tue,

Re: Transaction timeout

2023-12-22 Thread Junwang Zhao
ing something? I think this is by design, if you debug statement_timeout, it's the same behaviour, the timeout will be set for each command after the second command was called, you just aren't aware of this. I doubt people will set this in a transaction. > > [1] https://cirrus-ci.com/build/6574686130143232 > > -- > Regrads, > Japin Li > ChengDu WenWu Information Technology Co., Ltd. > -- Regards Junwang Zhao

Re: [meson] expose buildtype debug/optimization info to pg_config

2023-12-22 Thread Junwang Zhao
Hi, On Fri, Dec 15, 2023 at 10:20 PM Andres Freund wrote: > > Hi, > > On 2023-12-14 17:24:58 +0800, Junwang Zhao wrote: > > On Thu, Dec 14, 2023 at 4:50 PM Peter Eisentraut > > wrote: > > > > > > On 12.12.23 11:40, Junwang Zhao wrote: > >

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

2023-12-21 Thread Junwang Zhao
he first > implementation? If we need, what should we try? > > > Thanks, > -- > kou +PG_FUNCTION_INFO_V1(copy_testfmt_handler); +Datum +copy_testfmt_handler(PG_FUNCTION_ARGS) +{ + bool is_from = PG_GETARG_BOOL(0); + CopyFormatRoutine *cp = makeNode(CopyFormatRoutine);; + extra semicolon. -- Regards Junwang Zhao

Re: Transaction timeout

2023-12-19 Thread Junwang Zhao
On Wed, Dec 20, 2023 at 9:58 AM Thomas wen wrote: > > Hi Junwang Zhao > #should we invalidate lock_timeout? Or maybe just document this. > I think you mean when lock_time is greater than trasaction-time invalidate > lock_timeout or needs to be logged ? > I mean the interl

Re: Transaction timeout

2023-12-19 Thread Junwang Zhao
On Tue, Dec 19, 2023 at 10:51 PM Junwang Zhao wrote: > > On Tue, Dec 19, 2023 at 6:27 PM Andrey M. Borodin > wrote: > > > > > > > > > On 19 Dec 2023, at 13:26, Andrey M. Borodin wrote: > > > > > > I don’t have Windows machine, so

Re: Transaction timeout

2023-12-19 Thread Junwang Zhao
ut. + When transaction_timeout is *equal* to idle_in_transaction_session_timeout or statement_timeout, idle_in_transaction_session_timeout and statement_timeout will also be invalidated, the logic in the code seems right, though this document is a little bit inaccurate. -- Regards Junwang Zhao

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

2023-12-14 Thread Junwang Zhao
On Fri, Dec 15, 2023 at 12:45 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Fri, 15 Dec 2023 11:27:30 +0800, > Junwang Zhao wrote: > > >> > Adding a prefix or suf

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

2023-12-14 Thread Junwang Zhao
be installed in > most use cases. In the case, users don't need to choose one > handler. > > If we choose this option, it may be better that we also > provide a mechanism that can work without HANDLER. Searching > a function by name like tablesample method does is an option. > > > [1]: https://github.com/simdjson/simdjson > > > Thanks, > -- > kou -- Regards Junwang Zhao

Re: [meson] expose buildtype debug/optimization info to pg_config

2023-12-14 Thread Junwang Zhao
Hi Peter, Thanks for looking into this. On Thu, Dec 14, 2023 at 4:50 PM Peter Eisentraut wrote: > > On 12.12.23 11:40, Junwang Zhao wrote: > > build system using configure set VAL_CFLAGS with debug and > > optimization flags, so pg_config will show these infos. Some >

Re: Simplify newNode()

2023-12-13 Thread Junwang Zhao
e comments /* need the tag, at least */ after result->type > = tag; by the way? I don't think so, the comment has the meaning of the requested size should at least the size of Node, which contains just a NodeTag. typedef struct Node { NodeTag type; } Node; > > > > Zhang Mingli > www.hashdata.xyz -- Regards Junwang Zhao

[meson] expose buildtype debug/optimization info to pg_config

2023-12-12 Thread Junwang Zhao
build system using configure set VAL_CFLAGS with debug and optimization flags, so pg_config will show these infos. Some extensions depend on the mechanism. This patch exposes these flags with a typo fixed together. -- Regards Junwang Zhao 0001-meson-expose-buildtype-debug-optimization-info

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

2023-12-11 Thread Junwang Zhao
sketched the above idea including a test module in > src/test/module/test_copy_format, based on v2 patch. It's not splitted > and is dirty so just for discussion. > The test_copy_format extension doesn't use the fields of CopyToState and CopyFromState in this patch, I think we should move CopyFromStateData and CopyToStateData to commands/copy.h, what do you think? The framework in the patch LGTM. > > Regards, > > -- > Masahiko Sawada > Amazon Web Services: https://aws.amazon.com -- Regards Junwang Zhao

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

2023-12-11 Thread Junwang Zhao
; Btw, will any of you here be in Prague next week ? > Would be a good opportunity to discuss this in person. Sorry, no. > > > Best Regards > Hannu > > On Sat, Dec 9, 2023 at 9:39 AM Junwang Zhao wrote: > > > > On Sat, Dec 9, 2023 at 10:43 AM Hayato Kuroda (Fujitsu) > &g

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

2023-12-09 Thread Junwang Zhao
Forgive me for making so much noise about approach 2, I just want to hear about more suggestions of the final shape of this feature. > > Thanks, > -- > kou -- Regards Junwang Zhao

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

2023-12-09 Thread Junwang Zhao
gt; *slot); > +extern void CopyToFormatBinaryEnd(CopyToState cstate); > +extern void CopyFromFormatBinaryStart(CopyFromState cstate, TupleDesc > tupDesc); > +extern bool CopyFromFormatBinaryNext(CopyFromState cstate, > ExprContext *econtext, > + > Datum *values, bool *nulls); > +extern void CopyFromFormatBinaryErrorCallback(CopyFromState cstate); > ``` > > FYI - If you add files for {text|csv|binary}, these declarations can be > removed. > > Best Regards, > Hayato Kuroda > FUJITSU LIMITED > Thanks for all the valuable suggestions. -- Regards Junwang Zhao

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

2023-12-07 Thread Junwang Zhao
On Fri, Dec 8, 2023 at 3:27 AM Masahiko Sawada wrote: > > On Fri, Dec 8, 2023 at 1:39 AM Andrew Dunstan wrote: > > > > > > On 2023-12-07 Th 03:37, Junwang Zhao wrote: > > > > > > The point of this refactor (from my view) is to make it possible to add &

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

2023-12-07 Thread Junwang Zhao
On Thu, Dec 7, 2023 at 1:05 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Wed, 6 Dec 2023 22:07:51 +0800, > Junwang Zhao wrote: > > > Should we extract both *cop

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

2023-12-07 Thread Junwang Zhao
On Thu, Dec 7, 2023 at 8:39 AM Michael Paquier wrote: > > On Wed, Dec 06, 2023 at 10:07:51PM +0800, Junwang Zhao wrote: > > I read the thread[1] you posted and I think Andres's suggestion sounds > > great. > > > > Should we extract both *copy to* and

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

2023-12-06 Thread Junwang Zhao
- > Daniel Vérité > https://postgresql.verite.pro/ > Twitter: @DanielVerite > > -- Regards Junwang Zhao

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

2023-12-06 Thread Junwang Zhao
On Wed, Dec 6, 2023 at 3:28 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Wed, 6 Dec 2023 15:11:34 +0800, > Junwang Zhao wrote: > > > For the extra curly

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

2023-12-05 Thread Junwang Zhao
On Wed, Dec 6, 2023 at 2:19 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Wed, 6 Dec 2023 11:18:35 +0800, > Junwang Zhao wrote: > > > For the modern formats(parquet, orc, a

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

2023-12-05 Thread Junwang Zhao
will they be implemented as extensions or in core? The patch looks good except for a pair of extra curly braces. > > [1]: > https://www.postgresql.org/message-id/flat/3741749.1655952719%40sss.pgh.pa.us#2bb7af4a3d2c7669f9a49808d777a20d > > > Thanks, > -- > kou > > -- Regards Junwang Zhao

Re: Re: How to solve the problem of one backend process crashing and causing other processes to restart?

2023-11-13 Thread Junwang Zhao
> >> programmers to deal with minutiae like undoing resource acquisition. > >> Even with that, you'd have to wonder about the number of bugs > >> existing in such necessarily-poorly-tested code paths. > > > >Yes. > >I think that PostgreSQL's approach is superior: rather than investing in > >code to mitigate the impact of data corruption caused by a crash, invest > >in quality code that doesn't crash in the first place. > > > >Euphemistically naming a crash "ORA-600 error" seems to be part of > >their strategy. > > > >Yours, > >Laurenz Albe > > -- Regards Junwang Zhao

Re: make pg_ctl more friendly

2023-11-08 Thread Junwang Zhao
On Thu, Nov 9, 2023 at 3:08 PM Junwang Zhao wrote: > > On Thu, Nov 9, 2023 at 9:57 AM Crisp Lee wrote: > > > > Hi, > > > > I know it. But my question is not that. I did a PITR operation with > > recovery_target_name and recovery_target_action('shutdown').

Re: make pg_ctl more friendly

2023-11-08 Thread Junwang Zhao
; recovery.done. >> >> DB_SHUTDOWNED cannot be encountered while recovery is ongoing. If there was a >> hard crash, you'd see DB_IN_ARCHIVE_RECOVERY or such, if the command was shut >> down orderly before PITR has finished, you'd see DB_SHUTDOWNED_IN_RECOVERY. >> >> - Andres A

Re: Don't pass NULL pointer to strcmp().

2023-11-01 Thread Junwang Zhao
hed. > > [1] https://github.com/higuoxing/guc_crash/tree/pg > Can we set a string guc to NULL? If not, `*lconf->variable == NULL` would be unnecessary. > -- > Best Regards, > Xing -- Regards Junwang Zhao

Re: Simplify xlogreader.c with XLogRec* macros

2023-10-31 Thread Junwang Zhao
these can also be rewrite to: if (!XLogRecHasBlockRef(record, block_id)) -- Regards Junwang Zhao

Re: Add trailing commas to enum definitions

2023-10-24 Thread Junwang Zhao
On Tue, Oct 24, 2023 at 4:34 AM Nathan Bossart wrote: > > On Mon, Oct 23, 2023 at 05:55:32PM +0800, Junwang Zhao wrote: > > On Mon, Oct 23, 2023 at 2:37 PM Peter Eisentraut > > wrote: > >> Since C99, there can be a trailing comma after the last value in an enum

Re: Add trailing commas to enum definitions

2023-10-23 Thread Junwang Zhao
; case people want to use those with older compilers. There were also a > small number of cases where the enum type wasn't used anywhere (but the > enum values were), which ended up confusing pgindent a bit. -- Regards Junwang Zhao

Re: [dynahash] do not refill the hashkey after hash_search

2023-09-14 Thread Junwang Zhao
On Wed, Sep 13, 2023 at 5:28 PM John Naylor wrote: > > > On Wed, Sep 13, 2023 at 3:46 PM Junwang Zhao wrote: > > > > On Wed, Sep 13, 2023 at 4:22 PM John Naylor > > wrote: > > > > - memset(part_entry, 0, sizeof(LogicalRepPartMapEntry)); > > >

Re: [dynahash] do not refill the hashkey after hash_search

2023-09-13 Thread Junwang Zhao
On Wed, Sep 13, 2023 at 4:22 PM John Naylor wrote: > > > On Wed, Sep 13, 2023 at 1:47 PM Junwang Zhao wrote: > > > > Hi hackers, > > > > It's not necessary to fill the key field for most cases, since > > hash_search has already done that for you. For

[dynahash] do not refill the hashkey after hash_search

2023-09-13 Thread Junwang Zhao
the key field after insert it into the dynahash. This patch fixed some most abnormal ones, instead of refilling the key field of primitive types, adding some assert might be a better choice. -- Regards Junwang Zhao 0001-do-not-refill-the-hashkey-after-hash_search.patch Description: Binary data

Re: [BackendXidGetPid] only access allProcs when xid matches

2023-09-07 Thread Junwang Zhao
oke the given function a million times. That > > way we might be able to catch some miniscule improvement per row. > > > > If the performance is measurable, we can mark the CF entry as ready > > for committer. > > > > -- > > Best Wishes, > > Ashuto

Re: [BackendXidGetPid] only access allProcs when xid matches

2023-09-07 Thread Junwang Zhao
proc->pid; > break; > > Saying that, moving the declarations into the inner loop is usually a > good practice, but I would just keep two variables instead of one for > the sake of readability. That's a nit, sure. I remember I split this into two lines in v2 patch. Wh

Re: Should we use MemSet or {0} for struct initialization?

2023-08-31 Thread Junwang Zhao
e5f8-3c37-d185-4bbc-1de163ac4b10%40enterprisedb.com > > (If so, it deserves a comment to keep people from trying to change it...) > > > > And with a rough scan the MemSet calls in pg_stat_get_backend_subxact() > > > can also be replaced with {0}, so include that in the pa

Re: Should we use MemSet or {0} for struct initialization?

2023-08-31 Thread Junwang Zhao
ignment/padding to 0 as well, but since we will not access the alignment/padding, so they give the same effect. I bet {0} should be faster since there is no function call, but I'm not 100% sure ;) -- Regards Junwang Zhao

Re: [PATCH v1] PQputCopyEnd never returns 0, fix the inaccurate comment

2023-08-29 Thread Junwang Zhao
On Tue, Aug 29, 2023 at 6:40 AM Michael Paquier wrote: > > On Mon, Aug 28, 2023 at 09:46:07PM +0800, Junwang Zhao wrote: > > Yeah, it makes sense to me, or maybe just `PQputCopyEnd(...) == -1`, > > let's wait for some other opinions. > > One can argue that PQputCop

Re: [PATCH v1] PQputCopyEnd never returns 0, fix the inaccurate comment

2023-08-28 Thread Junwang Zhao
o and no one cares > about. Perhaps this function should be refactored too for consistency. > > Thoughts? > > -- > Best regards, > Aleksander Alekseev -- Regards Junwang Zhao

[PATCH v1] PQputCopyEnd never returns 0, fix the inaccurate comment

2023-08-28 Thread Junwang Zhao
PQputCopyEnd returns 1 or -1, never 0, I guess the comment was copy/paste from PQputCopyData's comment, this should be fixed. -- Regards Junwang Zhao v1-0001-PQputCopyEnd-never-returns-0-fix-the-inaccurate-c.patch Description: Binary data

Re: [dsm] comment typo

2023-08-21 Thread Junwang Zhao
On Mon, Aug 21, 2023 at 5:16 PM Daniel Gustafsson wrote: > > > On 18 Aug 2023, at 11:10, Junwang Zhao wrote: > > > > In the following sentence, I believe either 'the' or 'a' should be kept, not > > both. I here keep the 'the', but feel free to change. > > >

[dsm] comment typo

2023-08-18 Thread Junwang Zhao
memory segment within this -- -- Regards Junwang Zhao

[question] difference between vm_extend and fsm_extend

2023-08-10 Thread Junwang Zhao
question is why does `fsm_extend` not need the invalidation step? -- Regards Junwang Zhao

Re: [BackendXidGetPid] only access allProcs when xid matches

2023-08-10 Thread Junwang Zhao
On Thu, Aug 10, 2023 at 4:11 PM Ashutosh Bapat wrote: > > Please add this to commitfest so that it's not forgotten. > Added [1], thanks [1]: https://commitfest.postgresql.org/44/4495/ > On Wed, Aug 9, 2023 at 8:37 PM Junwang Zhao wrote: > > > > On Wed, Aug 9, 2023 at

Re: [BackendXidGetPid] only access allProcs when xid matches

2023-08-09 Thread Junwang Zhao
On Wed, Aug 9, 2023 at 10:46 PM Ashutosh Bapat wrote: > > On Wed, Aug 9, 2023 at 9:30 AM Junwang Zhao wrote: > > > > In function `BackendXidGetPid`, when looping every proc's > > TransactionId, there is no need to access its PGPROC since there > > is

[BackendXidGetPid] only access allProcs when xid matches

2023-08-08 Thread Junwang Zhao
ode. -- Regards Junwang Zhao 0001-BackendXidGetPid-only-access-allProcs-when-xid-match.patch Description: Binary data

[PATCH] [zh_CN.po] fix a typo in simplified Chinese translation file

2023-08-01 Thread Junwang Zhao
add the missing leading `l` for log_statement_sample_rate -- Regards Junwang Zhao 0001-zh_CN.po-fix-a-typo-in-simplified-Chinese-translatio.patch Description: Binary data

Re: pg_upgrade fails with in-place tablespace

2023-07-31 Thread Junwang Zhao
i Zhao Seems like allow_in_place_tablespaces is a developer only guc, and it is not for end user usage. check this commit 7170f2159fb21b62c263acd458d781e2f3c3f8bb -- Regards Junwang Zhao

Re: table_open/table_close with different lock mode

2023-07-21 Thread Junwang Zhao
On Fri, Jul 21, 2023 at 2:57 PM Gurjeet Singh wrote: > > On Thu, Jul 20, 2023 at 11:38 PM Junwang Zhao wrote: > > > > On Fri, Jul 21, 2023 at 2:26 PM Michael Paquier wrote: > > > > > > On Fri, Jul 21, 2023 at 02:05:56PM +0800, Junwang Zhao wrote: > > &

Re: table_open/table_close with different lock mode

2023-07-21 Thread Junwang Zhao
On Fri, Jul 21, 2023 at 2:26 PM Michael Paquier wrote: > > On Fri, Jul 21, 2023 at 02:05:56PM +0800, Junwang Zhao wrote: > > I noticed there are some places calling table_open with > > RowExclusiveLock but table_close with NoLock, like in function > > toast_save_datum. >

table_open/table_close with different lock mode

2023-07-21 Thread Junwang Zhao
Hey hackers, I noticed there are some places calling table_open with RowExclusiveLock but table_close with NoLock, like in function toast_save_datum. Can anybody explain the underlying logic, thanks in advance. -- Regards Junwang Zhao

Re: session username in default psql prompt?

2023-05-27 Thread Junwang Zhao
> > > andrew > > -- > Andrew Dunstan > EDB: https://www.enterprisedb.com -- Regards Junwang Zhao

[pg_rewind] use the passing callback instead of global function

2023-04-25 Thread Junwang Zhao
`local_traverse_files` and `libpq_traverse_files` both have a callback parameter but instead use the global process_source_file which is no good for function encapsulation. -- Regards Junwang Zhao 0001-pg_rewind-use-the-passing-callback-instead-of-global.patch Description: Binary data

Re: Use INT_MAX for wal size related gucs's max value

2023-04-18 Thread Junwang Zhao
) / (1024 * 1024))) On Wed, Apr 19, 2023 at 11:33 AM Tom Lane wrote: > > Junwang Zhao writes: > > The wal size related gucs use the MB unit, so we should just use > > INT_MAX instead of MAX_KILOBYTES as the max value. > > The point of MAX_KILOBYTES is to avoid

Use INT_MAX for wal size related gucs's max value

2023-04-18 Thread Junwang Zhao
The wal size related gucs use the MB unit, so we should just use INT_MAX instead of MAX_KILOBYTES as the max value. -- Regards Junwang Zhao 0001-use-INT_MAX-for-wal-size-related-max-value.patch Description: Binary data

fix a typo in file src/backend/utils/adt/xid8funcs.c comment

2023-03-24 Thread Junwang Zhao
%s/pg_current_xact/pg_current_xact_id -- Regards Junwang Zhao 0001-typo-replace-pg_current_xact-with-pg_current_xact_id.patch Description: Binary data

[meson] add missing pg_attribute_aligned for MSVC in meson build

2022-10-13 Thread Junwang Zhao
Hi Andres, Commit ec3c9cc add pg_attribute_aligned in MSVC[1], which was pushed one day before the meson commits, so meson build missed this feature. [1]: https://www.postgresql.org/message-id/caaaqye-hbtzvr3msomtk+hyw2s0e0oapzmw8icsmytma+mn...@mail.gmail.com -- Regards Junwang Zhao 0001

Re: Non-decimal integer literals

2022-10-11 Thread Junwang Zhao
On Tue, Oct 11, 2022 at 4:59 PM Peter Eisentraut wrote: > > On 11.10.22 05:29, Junwang Zhao wrote: > > What do you think if we move these code into a static inline function? like: > > > > static inline char* > > process_digits(char *ptr, int32 *result) > > { &g

Re: Non-decimal integer literals

2022-10-10 Thread Junwang Zhao
ok around ecpg to see how this interacts with C-syntax > integer literals. I'm not aware of any particular issues, but it's > understandably tricky. > > Other than that, this seems pretty complete as a start. -- Regards Junwang Zhao

[PATCH v1] [meson] fix some typo to make it more readable

2022-10-05 Thread Junwang Zhao
Hi Andres, Seems there are some typo in file src/backend/meson.build comment, pls have a look. -- Regards Junwang Zhao 0001-meson-fix-some-typo-to-make-it-more-readable.patch Description: Binary data

[PATCH v1] [meson] add a default option prefix=/usr/local/pgsql

2022-09-30 Thread Junwang Zhao
autoconf set PREFIX to /usr/local/pgsql, so I think we should do the same in meson build. This will group all the targets generated by postgres in the same directory. -- Regards Junwang Zhao 0001-meson-add-a-default-option-prefix-usr-local-pgsql.patch Description: Binary data

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

2022-09-29 Thread Junwang Zhao
; created > successfully. > > I know this is a corner case, but it's difficult to figure it out when run > into it. So I add > an assertion to prevent it. > > > Thanks, > Xiaoran -- Regards Junwang Zhao

Re: [PATCH] polish the error message of creating proc

2022-09-21 Thread Junwang Zhao
On Wed, Sep 21, 2022 at 10:53 PM Tom Lane wrote: > > Junwang Zhao writes: > > I noticed that there are some translations under the backend/po directory, > > can we just change > > msgid "function \"%s\" already exists with same argument types" > >

Re: [PATCH] polish the error message of creating proc

2022-09-21 Thread Junwang Zhao
On Wed, Sep 21, 2022 at 8:17 PM Julien Rouhaud wrote: > > Hi, > > On Wed, Sep 21, 2022 at 07:45:01PM +0800, Junwang Zhao wrote: > > when a error occurs when creating proc, it should point out the > > specific proc kind instead of just printing "function". >

[PATCH] polish the error message of creating proc

2022-09-21 Thread Junwang Zhao
oldproc->oid, proowner)) aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_FUNCTION, -- Regards Junwang Zhao 0001-polish-the-error-message-of-creating-proc.patch Description: Binary data

Re: Modernizing our GUC infrastructure

2022-09-05 Thread Junwang Zhao
ah, yes, that makes sense ;) On Tue, Sep 6, 2022 at 10:48 AM Tom Lane wrote: > > Junwang Zhao writes: > > /* > > - * Create table with 20% slack > > + * Create hash table with 20% slack > > */ > > size_vars = num_vars + num_vars / 4; > > > Shou

Re: Modernizing our GUC infrastructure

2022-09-05 Thread Junwang Zhao
> 0004 brings that back down to being indistinguishable from the > speed with few GUCs. > > So I think this is good cleanup in its own right, plus it > removes one major objection to considering user-defined GUCs > as a supported feature. > > regards, tom lane > > [1] > https://www.postgresql.org/message-id/flat/CAFj8pRD053CY_N4%3D6SvPe7ke6xPbh%3DK50LUAOwjC3jm8Me9Obg%40mail.gmail.com > -- Regards Junwang Zhao

Re: [PATCH v1] fix potential memory leak in untransformRelOptions

2022-09-01 Thread Junwang Zhao
got it, thanks. Tom Lane 于2022年9月2日 周五01:13写道: > Junwang Zhao writes: > > I'm a little confused when we should call *pfree* and when we should not. > > A few lines before there is a call *text_to_cstring* in which it invokes > > *pfree* to free the unpacked text [

Re: [PATCH v1] fix potential memory leak in untransformRelOptions

2022-09-01 Thread Junwang Zhao
On Thu, Sep 1, 2022 at 10:10 PM Tom Lane wrote: > > Junwang Zhao writes: > > result = lappend(result, makeDefElem(pstrdup(s), val, -1)); > > + pfree(s); > > I wonder why it's pstrdup'ing s in the first place. > Maybe it's pstrdup'ing s so that the caller should

[PATCH v1] fix potential memory leak in untransformRelOptions

2022-09-01 Thread Junwang Zhao
(pstrdup(p)); } result = lappend(result, makeDefElem(pstrdup(s), val, -1)); + pfree(s); } return result; -- 2.33.0 -- Regards Junwang Zhao 0001-fix-potential-memory-leak-in-untransformRelOptions.patch Description: Binary data

use NoLock instead of the magic number 0

2022-09-01 Thread Junwang Zhao
Inside *add_local_<>_reloption*, we should pass NoLock instead of the magic 0 to init_<>_reloption, which makes more sense. -- Regards Junwang Zhao 0001-use-NoLock-instead-of-the-magic-0.patch Description: Binary data

Re: [PATCH v1] [doc] polish the comments of reloptions

2022-09-01 Thread Junwang Zhao
thoughts? On Tue, Aug 30, 2022 at 11:56 AM Junwang Zhao wrote: > > When adding an option, we have 5 choices (bool, integer, real, enum, string), > so the comments seem stale. > > There are some sentences missing *at ShareUpdateExclusiveLock*, this > patch adds them to make the

[PATCH v1] [doc] polish the comments of reloptions

2022-08-29 Thread Junwang Zhao
VACUUM, which uses a ShareUpdateExclusiveLock, -- 2.33.0 -- Regards Junwang Zhao 0001-doc-polish-the-comments-of-reloptions.patch Description: Binary data

  1   2   >