|From:||Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>|
|Subject:||Re: Patch: fix lock contention for HASHHDR.mutex|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
30.12.2015 16:01, Aleksander Alekseev:
> Here is a clean version of the patch. Step 1 is an optimization. Step 2
> refactors this:
> HTAB *
> ShmemInitHash(const char *name, /* table string name for shmem index */
> - long init_size, /* initial table size */
> + long init_size, /* initial table size XXX ignored,
> refactor! */
Hi, I found that the patch is still not reviewed, so I've looked it over.
I haven't dived into this subject before, so my comments will be more
general than relating to your investigation.
Sorry if some things seem like nitpicks, I just suppose that clear patch
would be more convenient for reviewers.
First of all, why not merge both patches into one? They aren't too big
Then, this thread became too tangled. I think it's worth to write a new
message with the patch, the test script, some results and brief overview
of how does it really works. It will make following review much easier.
+ /* number of entries in hash table */
+ long nentries[NUM_LOCK_PARTITIONS];
+ /* linked list of free elements */
+ HASHELEMENT *freeList[NUM_LOCK_PARTITIONS];
I think comments should be changed, to be more informative here.
+ if (IS_PARTITIONED(hashp->hctl))
+ partitions_number = NUM_LOCK_PARTITIONS;
+ partitions_number = 1;
+ nelem_alloc = ((int) nelem) / partitions_number;
+ if (nelem_alloc == 0)
+ nelem_alloc = 1;
Add a comment here too.
-/* Number of partitions of the shared buffer mapping hashtable */
-#define NUM_BUFFER_PARTITIONS 128
/* Number of partitions the shared lock tables are divided into */
-#define LOG2_NUM_LOCK_PARTITIONS 4
+#define LOG2_NUM_LOCK_PARTITIONS 7
#define NUM_LOCK_PARTITIONS (1 << LOG2_NUM_LOCK_PARTITIONS)
+/* Number of partitions of the shared buffer mapping hashtable */
+#define NUM_BUFFER_PARTITIONS NUM_LOCK_PARTITIONS
I'm sure, it was discussed above. but these definitions do not look
obvious at all.
Maybe you should explain this magic number 7 in the comment above?
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
|Next Message||Robert Haas||2016-01-21 14:25:39||Re: Inconsistent error handling in START_REPLICATION command|
|Previous Message||Ashutosh Bapat||2016-01-21 13:48:23||Re: postgres_fdw join pushdown (was Re: Custom/Foreign-Join-APIs)|