Suggest two small improvements for PITR.

2024-01-11 Thread Yura Sokolov
permitted. If idea is accepted, patches for tests will be applied as well. [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=patch;h=c945af80 --- Yura Sokolov.From 173cfc3762a97c300b618f863fd23433909cdb81 Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Wed, 3 May 2023 18:48:46 +03

Re: Vectorization of some functions and improving pg_list interface

2023-09-06 Thread Yura Sokolov
06.09.2023 13:24, Yura Sokolov wrote: 24.08.2023 17:07, Maxim Orlov wrote: Hi! Recently, I've been playing around with pg_lists and realize how annoying (maybe, I was a bit tired) some stuff related to the lists. For an example, see this code List *l1 = list_make4(1, 2, 3, 4

Re: Vectorization of some functions and improving pg_list interface

2023-09-06 Thread Yura Sokolov
24.08.2023 17:07, Maxim Orlov wrote: Hi! Recently, I've been playing around with pg_lists and realize how annoying (maybe, I was a bit tired) some stuff related to the lists. For an example, see this code List *l1 = list_make4(1, 2, 3, 4), *l2 = list_make4(5, 6, 7, 8),

Re: When IMMUTABLE is not.

2023-06-15 Thread Yura Sokolov
15.06.2023 17:49, Tom Lane пишет: "David G. Johnston" writes: The failure to find and execute the function code itself is not a failure mode that these markers need be concerned with. Assuming one can execute the function an immutable function will give the same answer for the same input

Re: When IMMUTABLE is not.

2023-06-15 Thread Yura Sokolov
15.06.2023 16:58, c...@anastigmatix.net пишет: On 2023-06-15 09:21, Tom Lane wrote: Yura Sokolov writes: not enough to be sure function doesn't manipulate data. Of course not.  It is the user's responsibility to mark functions properly. And also, isn't it the case that IMMUTABLE should

Re: When IMMUTABLE is not.

2023-06-15 Thread Yura Sokolov
15.06.2023 16:21, Tom Lane wrote: Yura Sokolov writes: I found, than declaration of function as IMMUTABLE/STABLE is not enough to be sure function doesn't manipulate data. Of course not. It is the user's responsibility to mark functions properly. Trying to enforce that completely

Re: When IMMUTABLE is not.

2023-06-15 Thread Yura Sokolov
of ERROR. And ERROR should be generated at same place, when it is generated for `immutable_direct`, but with check of "read_only" status through whole call stack instead of just direct function kind. - regards, Yura Sokolov Postgres Professional

When IMMUTABLE is not.

2023-06-15 Thread Yura Sokolov
when it is generated for `immutable_direct`, but with check of "read_only" status through whole call stack instead of just direct function kind. - regards, Yura Sokolov Postgres Professional immutable_not.sql Description: application/sql diff --git a/src/backend/executor/spi.c b/sr

Re: Let's make PostgreSQL multi-threaded

2023-06-07 Thread Yura Sokolov
_var (*(my_hello_var_t*)(CurSessionVar(my_hello_var_offset))) /* module.c */ size_t my_hello_var_offset = 0; void PG_init() { RegisterSessionVar(sizeof(my_hello_var_t), _hello_var_offset); } For security reasons, offset could be mangled. -- regards, Yura Sokolov

Re: Bug in jsonb_in function (14 & 15 version are affected)

2023-03-15 Thread Yura Sokolov
usage in token success or error reporting, - simplify json_lex_number and its usage a bit. Also he added tests for fixed bug. - Regards, Yura Sokolov. From 757a314d5fa9c6ba8334762b4a080763f02244c5 Mon Sep 17 00:00:00 2001 From: Nikita Glukhov Date: Tue, 14 Mar 2023 12:15:48 +0300 Subject: [PATCH]

Re: Reducing the chunk header sizes on all memory context types

2022-09-07 Thread Yura Sokolov
В Ср, 07/09/2022 в 16:13 +1200, David Rowley пишет: > On Tue, 6 Sept 2022 at 01:41, David Rowley wrote: > > > > On Fri, 2 Sept 2022 at 20:11, David Rowley wrote: > > > > > > On Thu, 1 Sept 2022 at 12:46, Tom Lane wrote: > > > > > > > > David Rowley writes: > > > > > Maybe we should just

plpython causes assertions with python debug build

2022-08-17 Thread Yura Sokolov
h-valgrind --without-pymalloc` Valgrind doesn't complain, so there are no memory related issues in plpython. regards ------ Yura Sokolov y.sokolov diff --git a/src/pl/plpython/plpy_elog.c b/src/pl/plpython/plpy_elog.c index 7c627eacfbf..aa1cf17b366 100644 --- a/src/pl/plpython/plpy_elog.c +++ b/src/p

Re: optimize lookups in snapshot [sub]xip arrays

2022-07-24 Thread Yura Sokolov
5960b8af917e9268881cd8df3f88320%40postgrespro.ru > [1] https://postgr.es/m/057a9a95-19d2-05f0-17e2-f46ff20e9b3e%402ndquadrant.com > I'm glad my idea has been reborn. Well, may be simplehash is not bad idea. While it certainly consumes more memory and CPU instructions. I'll try to review. regards, Yura Sokolov

Re: SLRUs in the main buffer pool, redux

2022-07-21 Thread Yura Sokolov
Good day, Thomas В Пт, 27/05/2022 в 23:24 +1200, Thomas Munro пишет: > Rebased, debugged and fleshed out a tiny bit more, but still with > plenty of TODO notes and questions. I will talk about this idea at > PGCon, so I figured it'd help to have a patch that actually applies, > even if it

Re: MultiXact\SLRU buffers configuration

2022-07-21 Thread Yura Sokolov
of patch diff. Rebased versions of first two patch parts are attached. regards, Yura Sokolov slru-ballast.sql Description: application/sql slru-call.sql Description: application/sql slru-func.sql Description: application/sql From 41ec9d1c54184c515d53ecc8021c4a998813f2a9 Mon Sep 17 00:00:00 2001

Re: Reducing the chunk header sizes on all memory context types

2022-07-17 Thread Yura Sokolov
В Вт, 12/07/2022 в 22:41 -0700, Andres Freund пишет: > Hi, > > On 2022-07-12 10:42:07 -0700, Andres Freund wrote: > > On 2022-07-12 17:01:18 +1200, David Rowley wrote: > > > There is at least one. It might be major; to reduce the AllocSet chunk > > > header from 16 bytes down to 8 bytes I had to

Re: Reducing the chunk header sizes on all memory context types

2022-07-12 Thread Yura Sokolov
Good day, David. В Вт, 12/07/2022 в 17:01 +1200, David Rowley пишет: > Over on [1], I highlighted that 40af10b57 (Use Generation memory > contexts to store tuples in sorts) could cause some performance > regressions for sorts when the size of the tuple is exactly a power of > 2. The reason for

Re: [PATCH] fix wait_event of pg_stat_activity in case of high amount of connections

2022-07-08 Thread Yura Sokolov
В Сб, 09/07/2022 в 02:32 +0300, Yura Sokolov пишет: > В Пт, 08/07/2022 в 11:04 -0400, Robert Haas пишет: > > On Fri, Jul 8, 2022 at 10:11 AM Yura Sokolov > > wrote: > > > I see analogy with Bus Stop: > > > - there is bus stop > > > - th

Re: [PATCH] fix wait_event of pg_stat_activity in case of high amount of connections

2022-07-08 Thread Yura Sokolov
В Пт, 08/07/2022 в 11:04 -0400, Robert Haas пишет: > On Fri, Jul 8, 2022 at 10:11 AM Yura Sokolov wrote: > > I see analogy with Bus Stop: > > - there is bus stop > > - there is a schedule of bus arriving this top > > - there are passengers, who every day travel

Re: [PATCH] fix wait_event of pg_stat_activity in case of high amount of connections

2022-07-08 Thread Yura Sokolov
В Пт, 08/07/2022 в 09:44 -0400, Robert Haas пишет: > On Thu, Jul 7, 2022 at 10:39 PM Kyotaro Horiguchi > wrote: > > At Thu, 7 Jul 2022 13:58:06 -0500, Justin Pryzby > > wrote in > > > I agree that this is a bug, since it can (and did) cause false positives > > > in a > > > monitoring system. >

Re: BufferAlloc: don't take two simultaneous locks

2022-06-28 Thread Yura Sokolov
В Вт, 28/06/2022 в 14:26 +0300, Yura Sokolov пишет: > В Вт, 28/06/2022 в 14:13 +0300, Yura Sokolov пишет: > > > Tests: > > - tests done on 2 socket Xeon 5220 2.20GHz with turbo bust disabled > > (ie max frequency is 2.20GHz) > > Forgot to mention: > - this

Re: BufferAlloc: don't take two simultaneous locks

2022-06-28 Thread Yura Sokolov
В Вт, 28/06/2022 в 14:13 +0300, Yura Sokolov пишет: > Tests: > - tests done on 2 socket Xeon 5220 2.20GHz with turbo bust disabled > (ie max frequency is 2.20GHz) Forgot to mention: - this time it was Centos7.9.2009 (Core) with Linux mn10 3.10.0-1160.el7.x86_64 Perhaps older kernel

Re: PG15 beta1 sort performance regression due to Generation context change

2022-06-02 Thread Yura Sokolov
Fr, 27/05/2022 в 10:51 -0400, Tom Lane writes: > Yura Sokolov writes: > > В Вт, 24/05/2022 в 17:39 -0700, Andres Freund пишет: > > > A variation on your patch would be to only store the offset to the block > > > header - that should always fit into 32bit (huge allocat

Re: PG15 beta1 sort performance regression due to Generation context change

2022-05-27 Thread Yura Sokolov
be encoded in chunk-body itself instead of header. I was confused with this, since there are valgrind hooks, and I was not sure how to change it (I'm not good at valgrind hooks). But after thinking more about I believe it is doable. regards --- Yura Sokolov

Re: BufferAlloc: don't take two simultaneous locks

2022-05-10 Thread Yura Sokolov
В Пт, 06/05/2022 в 10:26 -0400, Robert Haas пишет: > On Thu, Apr 21, 2022 at 6:58 PM Yura Sokolov wrote: > > At the master state: > > - SharedBufHash is not declared as HASH_FIXED_SIZE > > - get_hash_entry falls back to element_alloc too fast (just if it doesn't > >

Re: Multi-Master Logical Replication

2022-04-28 Thread Yura Sokolov
В Чт, 28/04/2022 в 17:37 +0530, vignesh C пишет: > On Thu, Apr 28, 2022 at 4:24 PM Yura Sokolov wrote: > > В Чт, 28/04/2022 в 09:49 +1000, Peter Smith пишет: > > > > > 1.1 ADVANTAGES OF MMLR > > > > > > - Increases write scalability (e.g., all node

Re: Multi-Master Logical Replication

2022-04-28 Thread Yura Sokolov
ration of MM. First iteration were not "simple" or "easy" already. But even that version had the hidden bug: rare but accumulating data difference between nodes. Attempt to fix this bug led to almost full rewrite of multi-master. (Disclaimer: I had no relation to both MM versions, I just work in the same firm). regards - Yura Sokolov

Re: BufferAlloc: don't take two simultaneous locks

2022-04-22 Thread Yura Sokolov
Btw, I've runned tests on EPYC (80 cores). 1 key per select conns | master | patch-v11 | master 1G | patch-v11 1G ++++ 1 | 29053 | 28959 | 26715 | 25631 2 | 53714 | 53002 | 55211 |

Re: BufferAlloc: don't take two simultaneous locks

2022-04-21 Thread Yura Sokolov
В Чт, 21/04/2022 в 16:24 -0400, Robert Haas пишет: > On Thu, Apr 21, 2022 at 5:04 AM Yura Sokolov wrote: > > $ pid=`ps x | awk '/checkpointer/ && !/awk/ { print $1 }'` > > $ gdb -p $pid -batch -ex 'p SharedBufHash->hctl->allocated.value' > > > > $1

Re: BufferAlloc: don't take two simultaneous locks

2022-04-21 Thread Yura Sokolov
e is "out of shared memory" which is avoidable with get_hash_entry modifications or with HASH_FIXED_SIZE + some spare items. Could CHECK_FOR_INTERRUPTS raise something? No: there is single line between LWLockRelease and LWLockAcquire, and it doesn't contain CHECK_FOR_INTERRUPTS. Therefore there is single fixable case of "out of shared memory" (by HASH_FIXED_SIZE or improvements to "get_hash_entry"). May be I'm not quite right at some point. I'd glad to learn. - regards Yura Sokolov

Re: BufferAlloc: don't take two simultaneous locks

2022-04-13 Thread Yura Sokolov
В Пт, 08/04/2022 в 16:46 +0900, Kyotaro Horiguchi пишет: > At Thu, 07 Apr 2022 14:14:59 +0300, Yura Sokolov > wrote in > > В Чт, 07/04/2022 в 16:55 +0900, Kyotaro Horiguchi пишет: > > > Hi, Yura. > > > > > > At Wed, 06 Apr 2022 16:17:28 +0300, Yura Soko

Re: BufferAlloc: don't take two simultaneous locks

2022-04-07 Thread Yura Sokolov
В Чт, 07/04/2022 в 16:55 +0900, Kyotaro Horiguchi пишет: > Hi, Yura. > > At Wed, 06 Apr 2022 16:17:28 +0300, Yura Sokolov > wrot > e in > > Ok, I got access to stronger server, did the benchmark, found weird > > things, and so here is new version :-) >

Re: BufferAlloc: don't take two simultaneous locks

2022-04-06 Thread Yura Sokolov
Good day, Kyotaoro-san. Good day, hackers. В Вс, 20/03/2022 в 12:38 +0300, Yura Sokolov пишет: > В Чт, 17/03/2022 в 12:02 +0900, Kyotaro Horiguchi пишет: > > At Wed, 16 Mar 2022 14:11:58 +0300, Yura Sokolov > > wrote in > > > В Ср, 16/03/2022 в 12:07 +0900,

Re: Speed up transaction completion faster after many relations are accessed in a transaction

2022-04-05 Thread Yura Sokolov
source owners usually form stack, so usually when owner searches for itself it is last added to list. Then `dlist_foreach` will find it sooner if it were added to the head. regards - Yura Sokolov Postgres Professional y.soko...@postgrespro.ru funny.fal...@gmail.com

Jumble Query with COERCE_SQL_SYNTAX

2022-03-29 Thread Yura Sokolov
Good day. v14 introduced the way to get original text for some kind of expressions using new 'funcformat' - COERCE_SQL_SYNTAX: - EXTRACT(part from timestamp) - (text IS [form] NORMALIZED) and others. Mentioned EXTRACT and NORMALIZED statements has parts, that are not usual arguments but some

Re: BufferAlloc: don't take two simultaneous locks

2022-03-20 Thread Yura Sokolov
В Чт, 17/03/2022 в 12:02 +0900, Kyotaro Horiguchi пишет: > At Wed, 16 Mar 2022 14:11:58 +0300, Yura Sokolov > wrote in > > В Ср, 16/03/2022 в 12:07 +0900, Kyotaro Horiguchi пишет: > > > At Tue, 15 Mar 2022 13:47:17 +0300, Yura Sokolov > > > wrote in &

Declare PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY for aarch64

2022-03-16 Thread Yura Sokolov
PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY for aarch64 [1] https://documentation-service.arm.com/static/61fbe8f4fa8173727a1b734e https://developer.arm.com/documentation/ddi0487/latest --- regards Yura Sokolov Postgres Professional y.soko...@postgrespro.ru funny.fal...@gmail.com From

Re: BufferAlloc: don't take two simultaneous locks

2022-03-16 Thread Yura Sokolov
В Ср, 16/03/2022 в 12:07 +0900, Kyotaro Horiguchi пишет: > At Tue, 15 Mar 2022 13:47:17 +0300, Yura Sokolov > wrote in > > В Вт, 15/03/2022 в 16:25 +0900, Kyotaro Horiguchi пишет: > > > Hmm. v8 returns stashed element with original patition index when the > >

Re: BufferAlloc: don't take two simultaneous locks

2022-03-15 Thread Yura Sokolov
В Вт, 15/03/2022 в 13:47 +0300, Yura Sokolov пишет: > В Вт, 15/03/2022 в 16:25 +0900, Kyotaro Horiguchi пишет: > > Thanks for the new version. > > > > At Tue, 15 Mar 2022 08:07:39 +0300, Yura Sokolov > > wrote in > > > В Пн, 14/03/2022 в 14:57 +0300, Yur

Re: BufferAlloc: don't take two simultaneous locks

2022-03-15 Thread Yura Sokolov
В Вт, 15/03/2022 в 13:47 +0300, Yura Sokolov пишет: > В Вт, 15/03/2022 в 16:25 +0900, Kyotaro Horiguchi пишет: > > > I lost access to Xeon 8354H, so returned to old Xeon X5675. > > ... > > > Strange thing: both master and patched version has higher > > > peak tp

Re: BufferAlloc: don't take two simultaneous locks

2022-03-15 Thread Yura Sokolov
В Вт, 15/03/2022 в 16:25 +0900, Kyotaro Horiguchi пишет: > Thanks for the new version. > > At Tue, 15 Mar 2022 08:07:39 +0300, Yura Sokolov > wrote in > > В Пн, 14/03/2022 в 14:57 +0300, Yura Sokolov пишет: > > > В Пн, 14/03/2022 в 17:12 +0900, Kyotaro Horiguchi пи

Re: BufferAlloc: don't take two simultaneous locks

2022-03-14 Thread Yura Sokolov
В Пн, 14/03/2022 в 14:57 +0300, Yura Sokolov пишет: > В Пн, 14/03/2022 в 17:12 +0900, Kyotaro Horiguchi пишет: > > At Mon, 14 Mar 2022 09:15:11 +0300, Yura Sokolov > > wrote in > > > В Пн, 14/03/2022 в 14:31 +0900, Kyotaro Horiguchi пишет: > > > > I'd lik

Re: BufferAlloc: don't take two simultaneous locks

2022-03-14 Thread Yura Sokolov
В Пн, 14/03/2022 в 17:12 +0900, Kyotaro Horiguchi пишет: > At Mon, 14 Mar 2022 09:15:11 +0300, Yura Sokolov > wrote in > > В Пн, 14/03/2022 в 14:31 +0900, Kyotaro Horiguchi пишет: > > > I'd like to ask you to remove nalloced from partitions then add a > > >

Re: BufferAlloc: don't take two simultaneous locks

2022-03-14 Thread Yura Sokolov
? 32bit for 32 partitions. But wouldn't bitmap became contention point itself? > No need to do something for the possible deviation issue. --- regards Yura Sokolov

Re: BufferAlloc: don't take two simultaneous locks

2022-03-13 Thread Yura Sokolov
killer?) > Subject: [PATCH 3/3] reduce memory allocation for non-partitioned dynahash > > memory allocation -> memory allocations For each dynahash instance single allocation were reduced. I think, 'memory allocation' is correct. Plural will be reduce memory allocations for non

Re: BufferAlloc: don't take two simultaneous locks

2022-03-13 Thread Yura Sokolov
s, which need to be > > treated > >* just like permanent relations. > >* > >* The usage_count starts out at 1 so that the buffer can survive one > >* clock-sweep pass. > > But if you think the current commet is fine, I don't

Re: BufferAlloc: don't take two simultaneous locks

2022-03-11 Thread Yura Sokolov
and !reuse cases but > BufTableInsert doesn't and always does HASH_ASSIGN. That looks > odd. We should use HASH_ENTER here. Thus I think it is more > reasonable that HASH_ENTRY uses the stashed entry if exists and > needed, or returns it to freelist if exists but not needed. > > What do you think about this? Well... I don't like it but I don't mind either. Code in HASH_ENTER and HASH_ASSIGN cases differs much. On the other hand, probably it is possible to merge it carefuly. I'll try. - regards Yura Sokolov

Re: BufferAlloc: don't take two simultaneous locks

2022-03-11 Thread Yura Sokolov
В Пт, 11/03/2022 в 15:30 +0900, Kyotaro Horiguchi пишет: > At Thu, 03 Mar 2022 01:35:57 +0300, Yura Sokolov > wrote in > > В Вт, 01/03/2022 в 10:24 +0300, Yura Sokolov пишет: > > > Ok, here is v4. > > > > And here is v5. > > > > First, there

Re: BufferAlloc: don't take two simultaneous locks

2022-03-02 Thread Yura Sokolov
В Вт, 01/03/2022 в 10:24 +0300, Yura Sokolov пишет: > Ok, here is v4. And here is v5. First, there was compilation error in Assert in dynahash.c . Excuse me for not checking before sending previous version. Second, I add third commit that reduces HASHHDR allocation size for non-partitio

Re: BufferAlloc: don't take two simultaneous locks

2022-02-28 Thread Yura Sokolov
В Пт, 25/02/2022 в 09:38 +, Simon Riggs пишет: > On Fri, 25 Feb 2022 at 09:24, Yura Sokolov wrote: > > > > This approach is cleaner than v1, but should also perform better > > > because there will be a 1:1 relationship between a buffer and its > > >

Re: BufferAlloc: don't take two simultaneous locks

2022-02-27 Thread Yura Sokolov
В Пт, 25/02/2022 в 09:01 -0800, Andres Freund пишет: > Hi, > > On 2022-02-25 12:51:22 +0300, Yura Sokolov wrote: > > > > +* The usage_count starts out at 1 so that the buffer can > > > > survive one > > > > +* clock-sweep pass. > &

Re: BufferAlloc: don't take two simultaneous locks

2022-02-25 Thread Yura Sokolov
Hello, Andres В Пт, 25/02/2022 в 00:04 -0800, Andres Freund пишет: > Hi, > > On 2022-02-21 11:06:49 +0300, Yura Sokolov wrote: > > From 04b07d0627ec65ba3327dc8338d59dbd15c405d8 Mon Sep 17 00:00:00 2001 > > From: Yura Sokolov > > Date: Mon, 21 Feb 2022 08:49:03 +

Re: BufferAlloc: don't take two simultaneous locks

2022-02-25 Thread Yura Sokolov
Hello, Simon. В Пт, 25/02/2022 в 04:35 +, Simon Riggs пишет: > On Mon, 21 Feb 2022 at 08:06, Yura Sokolov wrote: > > Good day, Kyotaro Horiguchi and hackers. > > > > В Чт, 17/02/2022 в 14:16 +0900, Kyotaro Horiguchi пишет: > > > At Wed, 16 Feb 2022 10:40:56 +03

Re: Accommodate startup process in a separate ProcState array slot instead of in MaxBackends slots.

2022-02-21 Thread Yura Sokolov
В Сб, 12/02/2022 в 16:56 +0530, Bharath Rupireddy пишет: > On Fri, Feb 11, 2022 at 7:56 PM Yura Sokolov wrote: > > В Сб, 16/10/2021 в 16:37 +0530, Bharath Rupireddy пишет: > > > On Thu, Oct 14, 2021 at 10:56 AM Fujii Masao > > > wrote: > > > > On 20

Re: BufferAlloc: don't take two simultaneous locks

2022-02-21 Thread Yura Sokolov
Good day, Kyotaro Horiguchi and hackers. В Чт, 17/02/2022 в 14:16 +0900, Kyotaro Horiguchi пишет: > At Wed, 16 Feb 2022 10:40:56 +0300, Yura Sokolov > wrote in > > Hello, all. > > > > I thought about patch simplification, and tested version > > without BufTable

Re: BufferAlloc: don't take two simultaneous locks

2022-02-15 Thread Yura Sokolov
and will attach graphs with next message. Patch is attached here. -- regards, Yura Sokolov Postgres Professional y.soko...@postgrespro.ru funny.fal...@gmail.com From 7f430bdaa748456ed6b59f16f32ac0ea55644a66 Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Fri, 14 Jan 2022 02:28:36 +0300

Re: BufferAlloc: don't take two simultaneous locks

2022-02-15 Thread Yura Sokolov
wHashValue, > LWLock *oldPartitionLock, > LWLock *newPartitionLock > ); Interesting suggestion, thanks. I'll think about. It has downside of bringing LWLock knowdlege to dynahash.c . But otherwise looks smart. - regards, Yura Sokolov

Re: Error "initial slot snapshot too large" in create replication slot

2022-02-13 Thread Yura Sokolov
ents should be written about new usage case for `takenDuringRecovery`. May be this field should be renamed at all? And there are checks for `takenDuringRecovery` in `heapgetpage` and `heapam_scan_sample_next_tuple`. Are this checks affected by the change? Neither the preceding discussion nor commit message answer me. --- regards Yura Sokolov Postgres Professional y.soko...@postgrespro.ru funny.fal...@gmail.com

Re: Accommodate startup process in a separate ProcState array slot instead of in MaxBackends slots.

2022-02-11 Thread Yura Sokolov
orm an Assert(when_i_am_startup_proc && > autovacuum_not_running) (this looks a bit dirty though)? Instead, we > can just enlarge the array in the master and be confident about the > fact that the startup process always has one dedicated slot. But this slot wont be used for most of cluster life. It will be just waste. And `Assert(there_is_startup_proc && autovacuum_not_running)` has value on its own, hasn't it? So why doesn't add it with comment. regards, Yura Sokolov

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-25 Thread Yura Sokolov
В Вт, 25/01/2022 в 21:20 +1300, David Rowley пишет: > On Tue, 25 Jan 2022 at 20:03, David Rowley wrote: > > On Tue, 25 Jan 2022 at 17:35, Yura Sokolov wrote: > > > And another attempt to fix tests volatility. > > > > FWIW, I had not really seen the point in addin

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-24 Thread Yura Sokolov
В Пн, 24/01/2022 в 16:24 +0300, Yura Sokolov пишет: > В Вс, 23/01/2022 в 14:56 +0300, Yura Sokolov пишет: > > В Чт, 20/01/2022 в 09:32 +1300, David Rowley пишет: > > > On Fri, 31 Dec 2021 at 00:14, Yura Sokolov > > > wrote: > > > > Suggested quic

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-24 Thread Yura Sokolov
В Вс, 23/01/2022 в 14:56 +0300, Yura Sokolov пишет: > В Чт, 20/01/2022 в 09:32 +1300, David Rowley пишет: > > On Fri, 31 Dec 2021 at 00:14, Yura Sokolov wrote: > > > Suggested quick (and valid) fix in the patch attached: > > > - If Append has single child, then

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-23 Thread Yura Sokolov
В Чт, 20/01/2022 в 09:32 +1300, David Rowley пишет: > On Fri, 31 Dec 2021 at 00:14, Yura Sokolov wrote: > > Suggested quick (and valid) fix in the patch attached: > > - If Append has single child, then copy its parallel awareness. > > I've been looking at this and I've gon

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-16 Thread Yura Sokolov
В Сб, 01/01/2022 в 15:19 +1300, David Rowley пишет: > On Fri, 31 Dec 2021 at 00:14, Yura Sokolov wrote: > > Problem: > > - Append path is created with explicitely parallel_aware = true > > - It has two child, one is trivial, other is parallel_aware = false . > >

Fix BUG #17335: Duplicate result rows in Gather node

2021-12-30 Thread Yura Sokolov
/m/17500.1551669976%40sss.pgh.pa.us [2] https://postgr.es/m/CAKJS1f_Wt_tL3S32R3wpU86zQjuHfbnZbFt0eqm%3DqcRFcdbLvw%40mail.gmail.com regards Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com From 47c6e161de4fc9d2d6eff45f427ebf49b4c9d11c Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Mon, 2

Re: BufferAlloc: don't take two simultaneous locks

2021-12-20 Thread Yura Sokolov
В Сб, 02/10/2021 в 01:25 +0300, Yura Sokolov пишет: > Good day. > > I found some opportunity in Buffer Manager code in BufferAlloc > function: > - When valid buffer is evicted, BufferAlloc acquires two partition > lwlocks: for partition for evicted block is in and partiti

Re: XTS cipher mode for cluster file encryption

2021-10-26 Thread Yura Sokolov
В Вт, 26/10/2021 в 11:08 +0800, Sasasu пишет: > On 2021/10/26 04:32, Yura Sokolov wrote: > > And among others Adiantum looks best: it is fast even without hardware > > acceleration, > > No, AES is fast on modern high-end hardware. > > on X86 AMD 3700X > type

Re: XTS cipher mode for cluster file encryption

2021-10-25 Thread Yura Sokolov
В Пн, 25/10/2021 в 12:12 -0400, Stephen Frost пишет: > Greetings, > > * Yura Sokolov (y.soko...@postgrespro.ru) wrote: > > В Чт, 21/10/2021 в 13:28 -0400, Stephen Frost пишет: > > > I really don't think this is necessary. Similar to PageSetChecksumCopy > > > and

Re: XTS cipher mode for cluster file encryption

2021-10-25 Thread Yura Sokolov
cle/view/7360 [4] https://github.com/google/adiantum [5] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=059c2a4d8e164dccc3078e49e7f286023b019a98 --- regards Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com

Re: Double partition lock in bufmgr

2021-10-11 Thread Yura Sokolov
В Пт, 18/12/2020 в 15:20 +0300, Konstantin Knizhnik пишет: > Hi hackers, > > I am investigating incident with one of out customers: performance of > the system isdropped dramatically. > Stack traces of all backends can be found here: > http://www.garret.ru/diag_20201217_102056.stacks_59644 >

Re: Speed up transaction completion faster after many relations are accessed in a transaction

2021-10-06 Thread Yura Sokolov
I've made some remarks in related thread: https://www.postgresql.org/message-id/flat/0A3221C70F24FB45833433255569204D1FB976EF@G01JPEXMBYT05 The new status of this patch is: Waiting on Author

Re: Use simplehash.h instead of dynahash in SMgr

2021-10-06 Thread Yura Sokolov
E->segments` array. I think, second option is more prefered: - `DH_TYPE->segments[x]` inevitable accessed on every operation, therefore why not store some info here? - if nitems/used_items will be in `DH_TYPE->segments[x]`, then hashtable iteration doesn't need bitmap at all - there will b

Re: BufferAlloc: don't take two simultaneous locks

2021-10-03 Thread Yura Sokolov
В Пт, 01/10/2021 в 15:46 -0700, Zhihong Yu wrote: > > > On Fri, Oct 1, 2021 at 3:26 PM Yura Sokolov > wrote: > > Good day. > > > > I found some opportunity in Buffer Manager code in BufferAlloc > > function: > > - When valid buffer is evicted, Buff

BufferAlloc: don't take two simultaneous locks

2021-10-01 Thread Yura Sokolov
, Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com From a1606eaa124fc497763ed5e28e22cbc8f6443b33 Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Wed, 22 Sep 2021 13:10:37 +0300 Subject: [PATCH v0] bufmgr: do not acquire two partition locks. Acquiring two partition locks leads to complex

Avoid dynahash's freelist in BufferAlloc.

2021-09-22 Thread Yura Sokolov
.ru funny.fal...@gmail.com From 2afbc5a59c3ccd3fec14105aff40252eeaacf40c Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Wed, 22 Sep 2021 13:10:37 +0300 Subject: [PATCH] More gentle dynahash usage in buffer allocation. When BufferAlloc reuses some valid buffer, there is no need to go thro

jff: checksum algorithm is not as intended

2021-08-29 Thread Yura Sokolov
x(0x0327ff01) (where mix is a `__tmp` to `checksum` transformation) regards, Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com PS. Test program in Crystal language is attached and output for current CHECKSUM_COMP implementation and "correct" (intended). Excuse me for Crystal,

Re: Bug in huge simplehash

2021-08-13 Thread Yura Sokolov
Ranier Vilela писал 2021-08-13 14:12: Em sex., 13 de ago. de 2021 às 07:15, Andres Freund escreveu: Hi, On 2021-08-13 12:44:17 +0300, Yura Sokolov wrote: Andres Freund писал 2021-08-13 12:21: Any chance you'd write a test for simplehash with such huge amount of values? It'd require

Re: Bug in huge simplehash

2021-08-13 Thread Yura Sokolov
Andres Freund писал 2021-08-13 12:21: Hi, On 2021-08-10 11:52:59 +0300, Yura Sokolov wrote: - sizemask is set only in SH_COMPUTE_PARAMETERS . And it is set in this way: /* now set size */ tb->size = size; if (tb->size == SH_MAX_SIZE) tb->siz

Re: Bug in huge simplehash

2021-08-10 Thread Yura Sokolov
Ranier Vilela писал 2021-08-10 14:21: Em ter., 10 de ago. de 2021 às 05:53, Yura Sokolov escreveu: I went to check SH_GROW and It is `SH_GROW(SH_TYPE *tb, uint32 newsize)` :-((( Therefore when `tb->size == SH_MAX_SIZE/2` and we call `SH_GROW(tb, tb->size * 2)`, then SH_GROW

Bug in huge simplehash

2021-08-10 Thread Yura Sokolov
== SH_MAX_SIZE/2` and we call `SH_GROW(tb, tb->size * 2)`, then SH_GROW(tb, 0) is called due to truncation. And SH_COMPUTE_PARAMETERS is also accepts `uint32 newsize`. Ahh... ok, patch is updated to fix this as well. regards. - Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com

Re: RFC: Improve CPU cache locality of syscache searches

2021-08-05 Thread Yura Sokolov
Andres Freund писал 2021-08-06 06:49: Hi, On 2021-08-06 06:43:55 +0300, Yura Sokolov wrote: Why don't use simplehash or something like that? Open-addressing schemes show superior cache locality. I thought about that as well - but it doesn't really resolve the question of what we want

Re: RFC: Improve CPU cache locality of syscache searches

2021-08-05 Thread Yura Sokolov
on-empty entry will be matched entry most of time, and memory lookup for key comparison will be amortized free. Note that 8byte entry with fill factor 0.66 consumes amortized 12.12 byte, while 16byte entry with fill factor 0.99 consumes amortized 16.16byte. regards, Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com

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

2021-07-29 Thread Yura Sokolov
In fact, my code uses bump allocator internally to avoid "per-allocation overhead" of "aset", "slab" or "generational". And IntegerSet2 version even uses it for all allocations since it has no reallocatable parts. Well, if datastructure has reallocatable pa

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

2021-07-29 Thread Yura Sokolov
Yura Sokolov писал 2021-07-29 18:29: I've attached IntegerSet2 patch for pgtools repo and benchmark results. Branch https://github.com/funny-falcon/pgtools/tree/integerset2 Strange web-mail client... I never can be sure what it will attach... Reattach benchmark results regards, Yura

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

2021-07-29 Thread Yura Sokolov
Masahiko Sawada писал 2021-07-29 17:29: On Thu, Jul 29, 2021 at 8:03 PM Yura Sokolov wrote: Masahiko Sawada писал 2021-07-29 12:11: > On Thu, Jul 29, 2021 at 3:53 AM Andres Freund > wrote: >> >> Hi, >> >> On 2021-07-27 13:06:56 +0900, Masahiko Sawada wrot

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

2021-07-29 Thread Yura Sokolov
esser memory consumption (and therefore better times) on 10x test, when page number exceed 2^23 (8M). It still produce "correct" result for test since every page is filled in the same way. Could you push your fixes for radix, please? regards, Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com

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

2021-07-27 Thread Yura Sokolov
intset replacement certainly. Using same trick from radix_to_key it will store tids efficiently: shift = pg_ceil_log2_32(MaxHeapTuplesPerPage); tid_i = ItemPointerGetOffsetNumber(tid); tid_i |= ItemPointerGetBlockNumber(tid) << shift; Will do today's evening. regards Yura Sokol

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

2021-07-25 Thread Yura Sokolov
ny-falcon/pgtools/tree/svtm/bdbench regards, Yura SokolovFrom 3a6c96cc705b1af412cf9300be6f676f6c5e4aa6 Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Sun, 25 Jul 2021 03:06:48 +0300 Subject: [PATCH] svtm - specialized vacuum tid map --- bdbench/Makefile | 2 +- bdbench/bdbench.c |

Re: rand48 replacement

2021-07-06 Thread Yura Sokolov
Fabien COELHO писал 2021-07-06 23:49: Hello Yura, However, I'm not enthousiastic at combining two methods depending on the range, the function looks complex enough without that, so I would suggest not to take this option. Also, the decision process adds to the average cost, which is

Re: rand48 replacement

2021-07-06 Thread Yura Sokolov
Fabien COELHO писал 2021-07-06 09:13: Hello Yura, I believe most "range" values are small, much smaller than UINT32_MAX. In this case, according to [1] fastest method is Lemire's one (I'd take original version from [2]) [...] Yep. I share your point that the range is more often 32 bits.

Re: rand48 replacement

2021-07-05 Thread Yura Sokolov
Fabien COELHO писал 2021-07-04 23:29: The important property of determinism is that if I set a seed, and then make an identical set of calls to the random API, the results will be identical every time, so that it's possible to write tests with predictable/repeatable results. Hmmm… I like my

Re: rand48 replacement

2021-07-03 Thread Yura Sokolov
Fabien COELHO wrote 2021-07-03 11:45: And a v5 where an unused test file does also compile if we insist. About patch: 1. PostgreSQL source uses `uint64` and `uint32`, but not `uint64_t`/`uint32_t` 2. I don't see why pg_prng_state could not be `typedef uint64 pg_prng_state[2];` 3. Then

Re: Extensible storage manager API - smgr hooks

2021-06-29 Thread Yura Sokolov
Anastasia Lubennikova писал 2021-06-30 00:49: Hi, hackers! Many recently discussed features can make use of an extensible storage manager API. Namely, storage level compression and encryption [1], [2], [3], disk quota feature [4], SLRU storage changes [5], and any other features that may want

Re: Add PortalDrop in exec_execute_message

2021-06-10 Thread Yura Sokolov
Alvaro Herrera wrote 2021-06-08 00:07: On 2021-May-27, Yura Sokolov wrote: Alvaro Herrera писал 2021-05-26 23:59: > I don't think they should do that. The portal remains open, and the > libpq interface does that. The portal gets closed at end of transaction > without the nee

Re: Clear empty space in a page.

2021-06-01 Thread Yura Sokolov
Hi, Andres Freund wrote 2021-05-31 00:07: Hi, On 2021-05-30 03:10:26 +0300, Yura Sokolov wrote: While this result is not directly applied to stock PostgreSQL, I believe page compression is important for full_page_writes with wal_compression enabled. And probably when PostgreSQL is used

Clear empty space in a page.

2021-05-29 Thread Yura Sokolov
idn't measure impact on raw performance yet. regards, Yura Sokolov aka funny_falconcommit 6abfcaeb87fcb396c5e2dccd434ce2511314ff76 Author: Yura Sokolov Date: Sun May 30 02:39:17 2021 +0300 Clear empty space in a page Write zeroes to just cleared space in PageRepair

Re: Add PortalDrop in exec_execute_message

2021-05-27 Thread Yura Sokolov
seek-able? regards, tom lane regards Yura Sokolov

Re: Add PortalDrop in exec_execute_message

2021-05-27 Thread Yura Sokolov
Alvaro Herrera писал 2021-05-26 23:59: On 2021-May-25, Yura Sokolov wrote: Tom Lane писал 2021-05-21 21:23: > Yura Sokolov writes: > > I propose to add PortalDrop at the 'if (completed)' branch of > > exec_execute_message. > > This violates our wire protocol

Re: Add PortalDrop in exec_execute_message

2021-05-24 Thread Yura Sokolov
Tom Lane писал 2021-05-21 21:23: Yura Sokolov writes: I propose to add PortalDrop at the 'if (completed)' branch of exec_execute_message. This violates our wire protocol specification, which specifically says If successfully created, a named portal object lasts till the end

Add PortalDrop in exec_execute_message

2021-05-19 Thread Yura Sokolov
Hi, hackers. I've been playing with "autoprepared" patch, and have got isolation "freeze-the-dead" test stuck on first VACUUM FREEZE statement. After some research I found issue is reproduced with unmodified master branch if extended protocol used. I've prepared ruby script for demonstration

  1   2   >