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

Commit8f75fd1

Browse files
committed
Fix contrib/bloom to not fail under CLOBBER_CACHE_ALWAYS.
The code was supposing that rd_amcache wouldn't disappear from under itduring a scan; which is wrong. Copy the data out of the relcache ratherthan trying to reference it there.
1 parenta928484 commit8f75fd1

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

‎contrib/bloom/bloom.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,11 @@ typedef struct BloomMetaPageData
110110
typedefstructBloomState
111111
{
112112
FmgrInfohashFn[INDEX_MAX_KEYS];
113-
BloomOptions*opts;/* stored in rd_amcache and defined at
114-
* creation time */
113+
BloomOptionsopts;/* copy of options on index's metapage */
115114
int32nColumns;
116115

117116
/*
118-
* sizeOfBloomTuple is index'sspecific, and it depends on reloptions, so
117+
* sizeOfBloomTuple is index-specific, and it depends on reloptions, so
119118
* precompute it
120119
*/
121120
SizesizeOfBloomTuple;

‎contrib/bloom/blscan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
9999
/* New search: have to calculate search signature */
100100
ScanKeyskey=scan->keyData;
101101

102-
so->sign=palloc0(sizeof(SignType)*so->state.opts->bloomLength);
102+
so->sign=palloc0(sizeof(SignType)*so->state.opts.bloomLength);
103103

104104
for (i=0;i<scan->numberOfKeys;i++)
105105
{
@@ -151,7 +151,7 @@ blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
151151
boolres= true;
152152

153153
/* Check index signature with scan signature */
154-
for (i=0;i<so->state.opts->bloomLength;i++)
154+
for (i=0;i<so->state.opts.bloomLength;i++)
155155
{
156156
if ((itup->sign[i]&so->sign[i])!=so->sign[i])
157157
{

‎contrib/bloom/blutils.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ initBloomState(BloomState *state, Relation index)
155155
index->rd_amcache= (void*)opts;
156156
}
157157

158-
state->opts= (BloomOptions*)index->rd_amcache;
158+
memcpy(&state->opts,index->rd_amcache,sizeof(state->opts));
159159
state->sizeOfBloomTuple=BLOOMTUPLEHDRSZ+
160-
sizeof(SignType)*state->opts->bloomLength;
160+
sizeof(SignType)*state->opts.bloomLength;
161161
}
162162

163163
/*
@@ -228,10 +228,10 @@ signValue(BloomState *state, SignType *sign, Datum value, int attno)
228228
hashVal=DatumGetInt32(FunctionCall1(&state->hashFn[attno],value));
229229
mySrand(hashVal ^myRand());
230230

231-
for (j=0;j<state->opts->bitSize[attno];j++)
231+
for (j=0;j<state->opts.bitSize[attno];j++)
232232
{
233233
/* prevent mutiple evaluation */
234-
nBit=myRand() % (state->opts->bloomLength*BITSIGNTYPE);
234+
nBit=myRand() % (state->opts.bloomLength*BITSIGNTYPE);
235235
SETBIT(sign,nBit);
236236
}
237237
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp