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

Commit8d02b15

Browse files
committed
Eliminate ajust scan code. Since concurrent GiST it doesn't
do real work. That was missed during concurrence development.
1 parentcdfecf6 commit8d02b15

File tree

4 files changed

+6
-216
lines changed

4 files changed

+6
-216
lines changed

‎src/backend/access/gist/gist.c

Lines changed: 1 addition & 6 deletions
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/gist/gist.c,v 1.131 2006/03/31 23:32:05 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.132 2006/04/03 13:44:33 teodor Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -493,11 +493,6 @@ gistplacetopage(GISTInsertState *state, GISTSTATE *giststate)
493493

494494
END_CRIT_SECTION();
495495

496-
if (!is_leaf)/* small optimization: inform scan ablout
497-
* deleting... */
498-
gistadjscans(state->r,GISTOP_DEL,state->stack->blkno,
499-
state->stack->childoffnum,PageGetLSN(state->stack->page),oldlsn);
500-
501496
if (state->ituplen>1)
502497
{/* previous is_splitted==true */
503498

‎src/backend/access/gist/gistscan.c

Lines changed: 3 additions & 205 deletions
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/gist/gistscan.c,v 1.62 2006/03/05 15:58:20 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.63 2006/04/03 13:44:33 teodor Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -20,37 +20,8 @@
2020
#include"utils/memutils.h"
2121
#include"utils/resowner.h"
2222

23-
/* routines defined and used here */
24-
staticvoidgistregscan(IndexScanDescscan);
25-
staticvoidgistdropscan(IndexScanDescscan);
26-
staticvoidgistadjone(IndexScanDescscan,intop,BlockNumberblkno,
27-
OffsetNumberoffnum,XLogRecPtrnewlsn,XLogRecPtroldlsn);
28-
staticvoidadjustiptr(IndexScanDescscan,ItemPointeriptr,GISTSearchStack*stk,
29-
intop,BlockNumberblkno,OffsetNumberoffnum,XLogRecPtrnewlsn,XLogRecPtroldlsn);
3023
staticvoidgistfreestack(GISTSearchStack*s);
3124

32-
/*
33-
* Whenever we start a GiST scan in a backend, we register it in
34-
* private space. Then if the GiST index gets updated, we check all
35-
* registered scans and adjust them if the tuple they point at got
36-
* moved by the update. We only need to do this in private space,
37-
* because when we update an GiST we have a write lock on the tree, so
38-
* no other process can have any locks at all on it. A single
39-
* transaction can have write and read locks on the same object, so
40-
* that's why we need to handle this case.
41-
*/
42-
typedefstructGISTScanListData
43-
{
44-
IndexScanDescgsl_scan;
45-
ResourceOwnergsl_owner;
46-
structGISTScanListData*gsl_next;
47-
}GISTScanListData;
48-
49-
typedefGISTScanListData*GISTScanList;
50-
51-
/* pointer to list of local scans on GiSTs */
52-
staticGISTScanListGISTScans=NULL;
53-
5425
Datum
5526
gistbeginscan(PG_FUNCTION_ARGS)
5627
{
@@ -60,7 +31,6 @@ gistbeginscan(PG_FUNCTION_ARGS)
6031
IndexScanDescscan;
6132

6233
scan=RelationGetIndexScan(r,nkeys,key);
63-
gistregscan(scan);
6434

6535
PG_RETURN_POINTER(scan);
6636
}
@@ -254,189 +224,17 @@ gistendscan(PG_FUNCTION_ARGS)
254224
pfree(scan->opaque);
255225
}
256226

257-
258-
gistdropscan(scan);
259-
260227
PG_RETURN_VOID();
261228
}
262229

263-
staticvoid
264-
gistregscan(IndexScanDescscan)
265-
{
266-
GISTScanListl;
267-
268-
l= (GISTScanList)palloc(sizeof(GISTScanListData));
269-
l->gsl_scan=scan;
270-
l->gsl_owner=CurrentResourceOwner;
271-
l->gsl_next=GISTScans;
272-
GISTScans=l;
273-
}
274-
275-
staticvoid
276-
gistdropscan(IndexScanDescscan)
277-
{
278-
GISTScanListl;
279-
GISTScanListprev;
280-
281-
prev=NULL;
282-
283-
for (l=GISTScans;l!=NULL&&l->gsl_scan!=scan;l=l->gsl_next)
284-
prev=l;
285-
286-
if (l==NULL)
287-
elog(ERROR,"GiST scan list corrupted -- could not find 0x%p",
288-
(void*)scan);
289-
290-
if (prev==NULL)
291-
GISTScans=l->gsl_next;
292-
else
293-
prev->gsl_next=l->gsl_next;
294-
295-
pfree(l);
296-
}
297-
298-
/*
299-
* ReleaseResources_gist() --- clean up gist subsystem resources.
300-
*
301-
* This is here because it needs to touch this module's static var GISTScans.
302-
*/
303-
void
304-
ReleaseResources_gist(void)
305-
{
306-
GISTScanListl;
307-
GISTScanListprev;
308-
GISTScanListnext;
309-
310-
/*
311-
* Note: this should be a no-op during normal query shutdown. However, in
312-
* an abort situation ExecutorEnd is not called and so there may be open
313-
* index scans to clean up.
314-
*/
315-
prev=NULL;
316-
317-
for (l=GISTScans;l!=NULL;l=next)
318-
{
319-
next=l->gsl_next;
320-
if (l->gsl_owner==CurrentResourceOwner)
321-
{
322-
if (prev==NULL)
323-
GISTScans=next;
324-
else
325-
prev->gsl_next=next;
326-
327-
pfree(l);
328-
/* prev does not change */
329-
}
330-
else
331-
prev=l;
332-
}
333-
}
334-
335-
void
336-
gistadjscans(Relationrel,intop,BlockNumberblkno,OffsetNumberoffnum,XLogRecPtrnewlsn,XLogRecPtroldlsn)
337-
{
338-
GISTScanListl;
339-
Oidrelid;
340-
341-
if (XLogRecPtrIsInvalid(newlsn)||XLogRecPtrIsInvalid(oldlsn))
342-
return;
343-
344-
relid=RelationGetRelid(rel);
345-
for (l=GISTScans;l!=NULL;l=l->gsl_next)
346-
{
347-
if (l->gsl_scan->indexRelation->rd_id==relid)
348-
gistadjone(l->gsl_scan,op,blkno,offnum,newlsn,oldlsn);
349-
}
350-
}
351-
352-
/*
353-
*gistadjone() -- adjust one scan for update.
354-
*
355-
*By here, the scan passed in is on a modified relation.Op tells
356-
*us what the modification is, and blkno and offind tell us what
357-
*block and offset index were affected. This routine checks the
358-
*current and marked positions, and the current and marked stacks,
359-
*to see if any stored location needs to be changed because of the
360-
*update. If so, we make the change here.
361-
*/
362-
staticvoid
363-
gistadjone(IndexScanDescscan,
364-
intop,
365-
BlockNumberblkno,
366-
OffsetNumberoffnum,XLogRecPtrnewlsn,XLogRecPtroldlsn)
367-
{
368-
GISTScanOpaqueso= (GISTScanOpaque)scan->opaque;
369-
370-
adjustiptr(scan,&(scan->currentItemData),so->stack,op,blkno,offnum,newlsn,oldlsn);
371-
adjustiptr(scan,&(scan->currentMarkData),so->markstk,op,blkno,offnum,newlsn,oldlsn);
372-
}
373-
374-
/*
375-
*adjustiptr() -- adjust current and marked item pointers in the scan
376-
*
377-
*Depending on the type of update and the place it happened, we
378-
*need to do nothing, to back up one record, or to start over on
379-
*the same page.
380-
*/
381-
staticvoid
382-
adjustiptr(IndexScanDescscan,
383-
ItemPointeriptr,GISTSearchStack*stk,
384-
intop,
385-
BlockNumberblkno,
386-
OffsetNumberoffnum,XLogRecPtrnewlsn,XLogRecPtroldlsn)
387-
{
388-
OffsetNumbercuroff;
389-
GISTScanOpaqueso;
390-
391-
if (ItemPointerIsValid(iptr))
392-
{
393-
if (ItemPointerGetBlockNumber(iptr)==blkno)
394-
{
395-
curoff=ItemPointerGetOffsetNumber(iptr);
396-
so= (GISTScanOpaque)scan->opaque;
397-
398-
switch (op)
399-
{
400-
caseGISTOP_DEL:
401-
/* back up one if we need to */
402-
if (curoff >=offnum&&XLByteEQ(stk->lsn,oldlsn))/* the same vesrion of
403-
* page */
404-
{
405-
if (curoff>FirstOffsetNumber)
406-
{
407-
/* just adjust the item pointer */
408-
ItemPointerSet(iptr,blkno,OffsetNumberPrev(curoff));
409-
}
410-
else
411-
{
412-
/*
413-
* remember that we're before the current tuple
414-
*/
415-
ItemPointerSet(iptr,blkno,FirstOffsetNumber);
416-
if (iptr==&(scan->currentItemData))
417-
so->flags |=GS_CURBEFORE;
418-
else
419-
so->flags |=GS_MRKBEFORE;
420-
}
421-
stk->lsn=newlsn;
422-
}
423-
break;
424-
default:
425-
elog(ERROR,"unrecognized GiST scan adjust operation: %d",
426-
op);
427-
}
428-
}
429-
}
430-
}
431-
432230
staticvoid
433231
gistfreestack(GISTSearchStack*s)
434-
{
232+
{
435233
while (s!=NULL)
436234
{
437235
GISTSearchStack*p=s->next;
438-
439236
pfree(s);
440237
s=p;
441238
}
442239
}
240+

‎src/backend/utils/resowner/resowner.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.18 2006/03/05 15:58:49 momjian Exp $
17+
* $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.19 2006/04/03 13:44:33 teodor Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -277,7 +277,6 @@ ResourceOwnerReleaseInternal(ResourceOwner owner,
277277
}
278278

279279
/* Clean up index scans too */
280-
ReleaseResources_gist();
281280
ReleaseResources_hash();
282281
}
283282

‎src/include/access/gistscan.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/access/gistscan.h,v 1.28 2006/03/05 15:58:53 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/access/gistscan.h,v 1.29 2006/04/03 13:44:33 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -22,7 +22,5 @@ extern Datum gistrescan(PG_FUNCTION_ARGS);
2222
externDatumgistmarkpos(PG_FUNCTION_ARGS);
2323
externDatumgistrestrpos(PG_FUNCTION_ARGS);
2424
externDatumgistendscan(PG_FUNCTION_ARGS);
25-
externvoidgistadjscans(Relationr,intop,BlockNumberblkno,OffsetNumberoffnum,XLogRecPtrnewlsn,XLogRecPtroldlsn);
26-
externvoidReleaseResources_gist(void);
2725

2826
#endif/* GISTSCAN_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp