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

Commit47d37f5

Browse files
committed
remove unused code, update ptrack.
1 parent41d0c92 commit47d37f5

File tree

14 files changed

+268
-274
lines changed

14 files changed

+268
-274
lines changed

‎src/backend/access/heap/ptrack.c

Lines changed: 256 additions & 153 deletions
Large diffs are not rendered by default.

‎src/backend/access/transam/xlog.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6763,7 +6763,6 @@ StartupXLOG(void)
67636763
do
67646764
{
67656765
boolswitchedTLI= false;
6766-
intnblock;
67676766

67686767
#ifdefWAL_DEBUG
67696768
if (XLOG_DEBUG||
@@ -6917,17 +6916,6 @@ StartupXLOG(void)
69176916
/* Pop the error context stack */
69186917
error_context_stack=errcallback.previous;
69196918

6920-
if (ptrack_enable)
6921-
for(nblock=0;nblock<xlogreader->max_block_id;nblock++)
6922-
{
6923-
if(xlogreader->blocks[nblock].forknum==MAIN_FORKNUM)
6924-
{
6925-
ptrack_add_block(xlogreader->blocks[nblock].blkno,
6926-
xlogreader->blocks[nblock].rnode);
6927-
ptrack_save();
6928-
}
6929-
}
6930-
69316919
/*
69326920
* Update lastReplayedEndRecPtr after this record has been
69336921
* successfully replayed.

‎src/backend/access/transam/xlogfuncs.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ pg_stop_backup(PG_FUNCTION_ARGS)
168168
PG_RETURN_LSN(stoppoint);
169169
}
170170

171+
171172
/*
172173
* pg_stop_backup_v2: finish taking exclusive or nonexclusive on-line backup.
173174
*
@@ -275,30 +276,6 @@ pg_stop_backup_v2(PG_FUNCTION_ARGS)
275276
return (Datum)0;
276277
}
277278

278-
Datum
279-
pg_ptrack_clear(PG_FUNCTION_ARGS)
280-
{
281-
if (!superuser()&& !has_rolreplication(GetUserId()))
282-
ereport(ERROR,
283-
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
284-
(errmsg("must be superuser or replication role to clear ptrack files"))));
285-
286-
ptrack_clear();
287-
288-
PG_RETURN_VOID();
289-
}
290-
291-
Datum
292-
pg_ptrack_get_and_clear(PG_FUNCTION_ARGS)
293-
{
294-
if (!superuser()&& !has_rolreplication(GetUserId()))
295-
ereport(ERROR,
296-
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
297-
(errmsg("must be superuser or replication role to clear ptrack files"))));
298-
299-
PG_RETURN_BYTEA_P(ptrack_get_and_clear(PG_GETARG_OID(0),PG_GETARG_OID(1)));
300-
}
301-
302279
/*
303280
* pg_switch_xlog: switch to next xlog file
304281
*

‎src/backend/access/transam/xloginsert.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include"access/xlog.h"
2424
#include"access/xlog_internal.h"
2525
#include"access/xloginsert.h"
26-
#include"access/ptrack.h"
2726
#include"catalog/pg_control.h"
2827
#include"common/pg_lzcompress.h"
2928
#include"miscadmin.h"
@@ -257,10 +256,6 @@ XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
257256
#endif
258257

259258
regbuf->in_use= true;
260-
if (ptrack_enable&&regbuf->forkno==MAIN_FORKNUM)
261-
{
262-
ptrack_add_block(regbuf->block,regbuf->rnode);
263-
}
264259
}
265260

266261
/*

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -783,18 +783,6 @@ ReadBufferWithoutRelcache(RelFileNode rnode, ForkNumber forkNum,
783783
mode,strategy,&hit);
784784
}
785785

786-
Buffer
787-
ReadBufferWithoutRelcache2(SMgrRelationsmgr,ForkNumberforkNum,
788-
BlockNumberblockNum,ReadBufferModemode,
789-
BufferAccessStrategystrategy)
790-
{
791-
boolhit;
792-
793-
returnReadBuffer_common(smgr,RELPERSISTENCE_PERMANENT,RELKIND_UNKNOWN,forkNum,blockNum,
794-
mode,strategy,&hit);
795-
}
796-
797-
798786
/*
799787
* ReadBuffer_common -- common logic for all ReadBuffer variants
800788
*

‎src/backend/storage/lmgr/lmgr.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -390,30 +390,6 @@ UnlockRelationForExtension(Relation relation, LOCKMODE lockmode)
390390
LockRelease(&tag,lockmode, false);
391391
}
392392

393-
void
394-
LockSmgrForExtension(SMgrRelationsmgr,LOCKMODElockmode)
395-
{
396-
LOCKTAGtag;
397-
398-
SET_LOCKTAG_SMGR(tag,smgr->smgr_rnode.node.relNode);
399-
400-
(void)LockAcquire(&tag,lockmode, false, false);
401-
}
402-
403-
/*
404-
*UnlockRelationForExtension
405-
*/
406-
void
407-
UnlockSmgrForExtension(SMgrRelationsmgr,LOCKMODElockmode)
408-
{
409-
LOCKTAGtag;
410-
411-
SET_LOCKTAG_SMGR(tag ,smgr->smgr_rnode.node.relNode);
412-
413-
LockRelease(&tag,lockmode, false);
414-
}
415-
416-
417393
/*
418394
*LockPage
419395
*
@@ -1064,11 +1040,6 @@ DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
10641040
tag->locktag_field3,
10651041
tag->locktag_field4);
10661042
break;
1067-
caseLOCKTAG_SMGR:
1068-
appendStringInfo(buf,
1069-
_("smgr lock %u"),
1070-
tag->locktag_field1);
1071-
break;
10721043
default:
10731044
appendStringInfo(buf,
10741045
_("unrecognized locktag type %d"),

‎src/include/access/ptrack.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
#include"storage/relfilenode.h"
88
#include"utils/relcache.h"
99

10-
externPGDLLIMPORT unsignedintblocks_track_count;
10+
/* Number of bits allocated for each heap block. */
11+
#definePTRACK_BITS_PER_HEAPBLOCK 1
1112

1213
externPGDLLIMPORTboolptrack_enable;
1314

14-
externvoidptrack_save(void);
15-
16-
externvoidptrack_add_block(BlockNumberblock_number,RelFileNoderel);
15+
externvoidptrack_add_block(Relationrel,BlockNumberheapBlk);
16+
externvoidptrack_add_block_redo(RelFileNodernode,BlockNumberheapBlk);
17+
externvoidptrack_pin(Relationrel,BlockNumberheapBlk,Buffer*buf);
18+
externvoidptrack_set(BlockNumberheapBlk,BufferptrackBuf);
1719

1820
externvoidptrack_clear(void);
1921
externbytea*ptrack_get_and_clear(Oidtablespace_oid,Oidtable_oid);

‎src/include/access/xlog_fn.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
externDatumpg_start_backup(PG_FUNCTION_ARGS);
1717
externDatumpg_stop_backup(PG_FUNCTION_ARGS);
1818
externDatumpg_stop_backup_v2(PG_FUNCTION_ARGS);
19-
externDatumpg_ptrack_clear(PG_FUNCTION_ARGS);
20-
externDatumpg_ptrack_get_and_clear(PG_FUNCTION_ARGS);
2119
externDatumpg_switch_xlog(PG_FUNCTION_ARGS);
2220
externDatumpg_create_restore_point(PG_FUNCTION_ARGS);
2321
externDatumpg_current_xlog_location(PG_FUNCTION_ARGS);
@@ -35,6 +33,5 @@ extern Datum pg_is_xlog_replay_paused(PG_FUNCTION_ARGS);
3533
externDatumpg_xlog_location_diff(PG_FUNCTION_ARGS);
3634
externDatumpg_is_in_backup(PG_FUNCTION_ARGS);
3735
externDatumpg_backup_start_time(PG_FUNCTION_ARGS);
38-
externDatumpg_ptrack_test(PG_FUNCTION_ARGS);
3936

4037
#endif/* XLOG_FN_H */

‎src/include/common/relpath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef enum ForkNumber
3939

4040
#defineMAX_FORKNUMPAGESTRACK_FORKNUM
4141

42-
#defineFORKNAMECHARS6/* max chars for a fork name */
42+
#defineFORKNAMECHARS5/* max chars for a fork name */
4343

4444
externconstchar*constforkNames[];
4545

‎src/include/miscadmin.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#defineMISCADMIN_H
2525

2626
#include"pgtime.h"/* for pg_time_t */
27-
#include"access/ptrack.h"
2827

2928

3029
#definePG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n"
@@ -131,14 +130,6 @@ do { \
131130
#defineSTART_CRIT_SECTION() (CritSectionCount++)
132131

133132
#defineEND_CRIT_SECTION() \
134-
do { \
135-
Assert(CritSectionCount > 0); \
136-
CritSectionCount--; \
137-
if (!CritSectionCount && ptrack_enable && blocks_track_count > 0) \
138-
ptrack_save(); \
139-
} while(0)
140-
141-
#defineEND_CRIT_SECTION_WITHOUT_TRACK() \
142133
do { \
143134
Assert(CritSectionCount > 0); \
144135
CritSectionCount--; \

‎src/include/storage/bufmgr.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include"storage/buf.h"
1919
#include"storage/bufpage.h"
2020
#include"storage/relfilenode.h"
21-
#include"storage/smgr.h"
2221
#include"utils/relcache.h"
2322
#include"utils/snapmgr.h"
2423
#include"utils/tqual.h"
@@ -173,10 +172,6 @@ extern Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum,
173172
externBufferReadBufferWithoutRelcache(RelFileNodernode,
174173
ForkNumberforkNum,BlockNumberblockNum,
175174
ReadBufferModemode,BufferAccessStrategystrategy);
176-
externBufferReadBufferWithoutRelcache2(SMgrRelationsmgr,
177-
ForkNumberforkNum,BlockNumberblockNum,
178-
ReadBufferModemode,BufferAccessStrategystrategy);
179-
180175
externvoidReleaseBuffer(Bufferbuffer);
181176
externvoidUnlockReleaseBuffer(Bufferbuffer);
182177
externvoidMarkBufferDirty(Bufferbuffer);

‎src/include/storage/lmgr.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include"lib/stringinfo.h"
1818
#include"storage/itemptr.h"
1919
#include"storage/lock.h"
20-
#include"storage/smgr.h"
2120
#include"utils/rel.h"
2221

2322

@@ -58,9 +57,6 @@ extern bool ConditionalLockRelationForExtension(Relation relation,
5857
LOCKMODElockmode);
5958
externintRelationExtensionLockWaiterCount(Relationrelation);
6059

61-
externvoidLockSmgrForExtension(SMgrRelationsmgr,LOCKMODElockmode);
62-
externvoidUnlockSmgrForExtension(SMgrRelationsmgr,LOCKMODElockmode);
63-
6460
/* Lock a page (currently only used within indexes) */
6561
externvoidLockPage(Relationrelation,BlockNumberblkno,LOCKMODElockmode);
6662
externboolConditionalLockPage(Relationrelation,BlockNumberblkno,LOCKMODElockmode);

‎src/include/storage/lock.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ typedef enum LockTagType
161161
* Also, we use DB OID = 0 for shared objects such as tablespaces.
162162
*/
163163
LOCKTAG_USERLOCK,/* reserved for old contrib/userlock code */
164-
LOCKTAG_ADVISORY,/* advisory user locks */
165-
LOCKTAG_SMGR/**/
164+
LOCKTAG_ADVISORY/* advisory user locks */
166165
}LockTagType;
167166

168167
#defineLOCKTAG_LAST_TYPELOCKTAG_ADVISORY
@@ -208,14 +207,6 @@ typedef struct LOCKTAG
208207
(locktag).locktag_type = LOCKTAG_RELATION_EXTEND, \
209208
(locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
210209

211-
#defineSET_LOCKTAG_SMGR(locktag,relfilenode) \
212-
((locktag).locktag_field1 = (relfilenode), \
213-
(locktag).locktag_field2 = 0, \
214-
(locktag).locktag_field3 = 0, \
215-
(locktag).locktag_field4 = 0, \
216-
(locktag).locktag_type = LOCKTAG_SMGR, \
217-
(locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD)
218-
219210
#defineSET_LOCKTAG_PAGE(locktag,dboid,reloid,blocknum) \
220211
((locktag).locktag_field1 = (dboid), \
221212
(locktag).locktag_field2 = (reloid), \

‎src/include/storage/smgr.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ typedef struct SMgrRelationData
4646
structSMgrRelationData**smgr_owner;
4747

4848
/*
49-
* These nextthree fields are not actually used or manipulated by smgr,
49+
* These nextfour fields are not actually used or manipulated by smgr,
5050
* except that they are reset to InvalidBlockNumber upon a cache flush
5151
* event (in particular, upon truncation of the relation). Higher levels
5252
* store cached state here so that it will be reset when truncation
53-
* happens. In allthree cases, InvalidBlockNumber means "unknown".
53+
* happens. In allfour cases, InvalidBlockNumber means "unknown".
5454
*/
5555
BlockNumbersmgr_targblock;/* current insertion target block */
5656
BlockNumbersmgr_fsm_nblocks;/* last known size of fsm fork */
5757
BlockNumbersmgr_vm_nblocks;/* last known size of vm fork */
58-
BlockNumbersmgr_ptrack_nblocks;/* last known size ofvm fork */
58+
BlockNumbersmgr_ptrack_nblocks;/* last known size ofptrack fork */
5959

6060
/*
6161
* It's unnecessary to create a physical file for a local temp

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp