Skip to content

Commit 89bbbfc

Browse files
antamelfunny-falcon
authored andcommitted
Use updated parse_filename_for_nontemp_relation() interface.
And place changes under \#if PG_VERSION_NUM >= 170000. Caused by: - 5c47c6546c413d5eb51c1626070a807026e6139d (PostgreSQL) Refactor parse_filename_for_nontemp_relation to parse more. - f1352d7 (ptrack extension) Ptrack 2.0 initial release Tags: ptrack
1 parent d427f73 commit 89bbbfc

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

engine.c

+12
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,13 @@ ptrack_mark_file(Oid dbOid, Oid tablespaceOid,
506506
BlockNumber blkno,
507507
nblocks = 0;
508508
struct stat stat_buf;
509+
#if PG_VERSION_NUM >= 170000
510+
RelFileNumber relNumber;
511+
unsigned segno;
512+
#else
509513
int oidchars;
510514
char oidbuf[OIDCHARS + 1];
515+
#endif
511516

512517
/* Do not track temporary relations */
513518
if (looks_like_temp_rel_name(filename))
@@ -519,12 +524,19 @@ ptrack_mark_file(Oid dbOid, Oid tablespaceOid,
519524
nodeDb(nodeOf(rnode)) = dbOid;
520525
nodeSpc(nodeOf(rnode)) = tablespaceOid;
521526

527+
#if PG_VERSION_NUM >= 170000
528+
if (!parse_filename_for_nontemp_relation(filename, &relNumber, &forknum, &segno))
529+
return;
530+
531+
nodeRel(nodeOf(rnode)) = relNumber;
532+
#else
522533
if (!parse_filename_for_nontemp_relation(filename, &oidchars, &forknum))
523534
return;
524535

525536
memcpy(oidbuf, filename, oidchars);
526537
oidbuf[oidchars] = '\0';
527538
nodeRel(nodeOf(rnode)) = atooid(oidbuf);
539+
#endif
528540

529541
/* Compute number of blocks based on file size */
530542
if (stat(filepath, &stat_buf) == 0)

ptrack.c

+14-1
Original file line numberDiff line numberDiff line change
@@ -330,25 +330,38 @@ ptrack_gather_filelist(List **filelist, char *path, Oid spcOid, Oid dbOid)
330330
/* Regular file inside database directory, otherwise skip it */
331331
if (dbOid != InvalidOid || spcOid == GLOBALTABLESPACE_OID)
332332
{
333+
#if PG_VERSION_NUM >= 170000
334+
RelFileNumber relNumber;
335+
unsigned segno;
336+
#else
333337
int oidchars;
334338
char oidbuf[OIDCHARS + 1];
339+
#endif
335340
char *segpath;
336341
PtrackFileList_i *pfl = palloc0(sizeof(PtrackFileList_i));
337342

338343
/*
339344
* Check that filename seems to be a regular relation file.
340345
*/
346+
#if PG_VERSION_NUM >= 170000
347+
if (!parse_filename_for_nontemp_relation(de->d_name, &relNumber, &pfl->forknum, &segno))
348+
continue;
349+
#else
341350
if (!parse_filename_for_nontemp_relation(de->d_name, &oidchars, &pfl->forknum))
342351
continue;
343-
352+
#endif
344353
/* Parse segno */
345354
segpath = strstr(de->d_name, ".");
346355
pfl->segno = segpath != NULL ? atoi(segpath + 1) : 0;
347356

348357
/* Fill the pfl in */
358+
#if PG_VERSION_NUM >= 170000
359+
nodeRel(pfl->relnode) = relNumber;
360+
#else
349361
memcpy(oidbuf, de->d_name, oidchars);
350362
oidbuf[oidchars] = '\0';
351363
nodeRel(pfl->relnode) = atooid(oidbuf);
364+
#endif
352365
nodeDb(pfl->relnode) = dbOid;
353366
nodeSpc(pfl->relnode) = spcOid == InvalidOid ? DEFAULTTABLESPACE_OID : spcOid;
354367
pfl->path = GetRelationPath(dbOid, nodeSpc(pfl->relnode),

0 commit comments

Comments
 (0)