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

Commit8282d6f

Browse files
committed
Persuade GIN to react to control-C in a reasonable amount of time
while building a GIN index.
1 parentb62f246 commit8282d6f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎src/backend/access/gin/gininsert.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
*$PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.12 2008/05/12 00:00:44 alvherre Exp $
11+
*$PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.13 2008/05/16 01:27:06 tgl Exp $
1212
*-------------------------------------------------------------------------
1313
*/
1414

@@ -246,7 +246,11 @@ ginBuildCallback(Relation index, HeapTuple htup, Datum *values,
246246
uint32nlist;
247247

248248
while ((list=ginGetEntry(&buildstate->accum,&entry,&nlist))!=NULL)
249+
{
250+
/* there could be many entries, so be willing to abort here */
251+
CHECK_FOR_INTERRUPTS();
249252
ginEntryInsert(index,&buildstate->ginstate,entry,list,nlist, TRUE);
253+
}
250254

251255
MemoryContextReset(buildstate->tmpCtx);
252256
ginInitBA(&buildstate->accum);
@@ -331,9 +335,14 @@ ginbuild(PG_FUNCTION_ARGS)
331335
reltuples=IndexBuildHeapScan(heap,index,indexInfo,
332336
ginBuildCallback, (void*)&buildstate);
333337

338+
/* dump remaining entries to the index */
334339
oldCtx=MemoryContextSwitchTo(buildstate.tmpCtx);
335340
while ((list=ginGetEntry(&buildstate.accum,&entry,&nlist))!=NULL)
341+
{
342+
/* there could be many entries, so be willing to abort here */
343+
CHECK_FOR_INTERRUPTS();
336344
ginEntryInsert(index,&buildstate.ginstate,entry,list,nlist, TRUE);
345+
}
337346
MemoryContextSwitchTo(oldCtx);
338347

339348
MemoryContextDelete(buildstate.tmpCtx);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp