Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit17ea8ff

Browse files
author
Nikita Glukhov
committed
Add jsonbc dictionary background workers
1 parentf26c21e commit17ea8ff

File tree

9 files changed

+436
-15
lines changed

9 files changed

+436
-15
lines changed

‎src/backend/postmaster/bgworker.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include"storage/shmem.h"
3535
#include"tcop/tcopprot.h"
3636
#include"utils/ascii.h"
37+
#include"utils/jsonbc_dict.h"
3738
#include"utils/ps_status.h"
3839
#include"utils/timeout.h"
3940

@@ -129,6 +130,9 @@ static const struct
129130
},
130131
{
131132
"ApplyWorkerMain",ApplyWorkerMain
133+
},
134+
{
135+
"JsonbcDictWorkerMain",JsonbcDictWorkerMain
132136
}
133137
};
134138

‎src/backend/postmaster/pgstat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3576,6 +3576,9 @@ pgstat_get_wait_ipc(WaitEventIPC w)
35763576
caseWAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE:
35773577
event_name="LogicalSyncStateChange";
35783578
break;
3579+
caseWAIT_EVENT_JSONBC_DICT_WORKER:
3580+
event_name="JsonbcDictionaryWorker";
3581+
break;
35793582
/* no default case, so that compiler will warn */
35803583
}
35813584

‎src/backend/storage/ipc/ipci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include"storage/sinvaladt.h"
4646
#include"storage/spin.h"
4747
#include"utils/backend_random.h"
48+
#include"utils/jsonbc_dict.h"
4849
#include"utils/snapmgr.h"
4950

5051

@@ -270,6 +271,7 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
270271
SyncScanShmemInit();
271272
AsyncShmemInit();
272273
BackendRandomShmemInit();
274+
JsonbcDictWorkerShmemInit();
273275

274276
#ifdefEXEC_BACKEND
275277

‎src/backend/utils/adt/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ OBJS = acl.o amutils.o arrayfuncs.o array_expanded.o array_selfuncs.o \
1717
geo_ops.o geo_selfuncs.o geo_spgist.o inet_cidr_ntop.o inet_net_pton.o\
1818
int.o int8.o json.o jsonb.o jsonb_gin.o jsonb_op.o jsonb_util.o\
1919
jsonfuncs.o json_generic.o json_gin.o json_op.o\
20-
jsonbc_util.o jsonbc_dict.o\
20+
jsonbc_util.o jsonbc_dict.ojsonbc_dict_worker.o\
2121
like.o lockfuncs.o mac.o mac8.o misc.o nabstime.o name.o\
2222
network.o network_gist.o network_selfuncs.o network_spgist.o\
2323
numeric.o numutils.o oid.o oracle_compat.o\

‎src/backend/utils/adt/jsonbc_dict.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333

3434
#defineJSONBC_DICT_TAB "pg_jsonbc_dict"
3535

36-
staticJsonbcKeyId
37-
jsonbcDictGetIdByNameSlow(JsonbcDictIddict,JsonbcKeyNamename,
38-
JsonbcKeyIdnextKeyId);
39-
4036
void
4137
jsonbcDictRemoveEntryById(JsonbcDictIddict,JsonbcKeyIdkey)
4238
{
@@ -99,7 +95,7 @@ jsonbcDictInsertEntry(JsonbcDictId dict, JsonbcKeyName name,
9995
returnnextKeyId;
10096
}
10197

102-
staticJsonbcKeyId
98+
JsonbcKeyId
10399
jsonbcDictGetIdByNameSeqCached(JsonbcDictIddict,JsonbcKeyNamename)
104100
{
105101
text*txt=cstring_to_text_with_len(name.s,name.len);
@@ -144,7 +140,7 @@ jsonbcDictGetIdByNameSeq(JsonbcDictId dict, JsonbcKeyName name, bool insert)
144140
{
145141
JsonbcKeyIdnextKeyId= (JsonbcKeyId)nextval_internal(dict, false);
146142

147-
id=jsonbcDictInsertEntry(dict,name,nextKeyId);
143+
id=jsonbcDictWorkerGetIdByName(dict,name,nextKeyId);
148144

149145
jsonbcDictInvalidateCache(dict,name);
150146
}
@@ -249,7 +245,7 @@ jsonbcDictGetNameById(JsonbcDictId dict, JsonbcKeyId id)
249245
}
250246

251247
#ifndefJSONBC_DICT_UPSERT
252-
staticJsonbcKeyId
248+
JsonbcKeyId
253249
jsonbcDictGetIdByNameSlow(JsonbcDictIddict,JsonbcKeyNamename,
254250
JsonbcKeyIdnextKeyId)
255251
{
@@ -259,8 +255,9 @@ jsonbcDictGetIdByNameSlow(JsonbcDictId dict, JsonbcKeyName name,
259255
#else
260256
staticSPIPlanPtrsavedPlanInsert=NULL;
261257

262-
staticJsonbcKeyId
263-
jsonbcDictGetIdByNameSlow(JsonbcDictIddict,JsonbcKeyNamename)
258+
JsonbcKeyId
259+
jsonbcDictGetIdByNameSlow(JsonbcDictIddict,JsonbcKeyNamename,
260+
JsonbcKeyIdnextKeyId)
264261
{
265262
OidargTypes[3]= {JsonbcDictIdTypeOid,TEXTOID,JsonbcKeyIdTypeOid};
266263
Datumargs[3];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp