index 637c0ce459766a3aaa24a9b0fd9468a60cb7244c..7f85071229b65c1293ad53548fe5070061ceb295 100644 (file)
@@ -1172,7 +1172,8 @@ sendDir(bbsink *sink, const char *path, int basepathlen, bool sizeonly,
int excludeIdx;
bool excludeFound;
ForkNumber relForkNum; /* Type of fork if file is a relation */
- int relOidChars; /* Chars in filename that are the rel oid */
+ int relnumchars; /* Chars in filename that are the
+ * relnumber */
/* Skip special stuff */
if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0)
@@ -1222,23 +1223,24 @@ sendDir(bbsink *sink, const char *path, int basepathlen, bool sizeonly,
/* Exclude all forks for unlogged tables except the init fork */
if (isDbDir &&
- parse_filename_for_nontemp_relation(de->d_name, &relOidChars,
+ parse_filename_for_nontemp_relation(de->d_name, &relnumchars,
&relForkNum))
{
/* Never exclude init forks */
if (relForkNum != INIT_FORKNUM)
{
char initForkFile[MAXPGPATH];
- char relOid[OIDCHARS + 1];
+ char relNumber[OIDCHARS + 1];
/*
* If any other type of fork, check if there is an init fork
- * with the same OID. If so, the file can be excluded.
+ * with the same RelFileNumber. If so, the file can be
+ * excluded.
*/
- memcpy(relOid, de->d_name, relOidChars);
- relOid[relOidChars] = '0円';
+ memcpy(relNumber, de->d_name, relnumchars);
+ relNumber[relnumchars] = '0円';
snprintf(initForkFile, sizeof(initForkFile), "%s/%s_init",
- path, relOid);
+ path, relNumber);
if (lstat(initForkFile, &statbuf) == 0)
{
index f053fe0495f5a81b49e17371b1137ee1dda0234c..647c458b52e3e797bd0fa1063b3e727f0e5c9f8e 100644 (file)
@@ -195,11 +195,11 @@ ResetUnloggedRelationsInDbspaceDir(const char *dbspacedirname, int op)
while ((de = ReadDir(dbspace_dir, dbspacedirname)) != NULL)
{
ForkNumber forkNum;
- int oidchars;
+ int relnumchars;
unlogged_relation_entry ent;
/* Skip anything that doesn't look like a relation data file. */
- if (!parse_filename_for_nontemp_relation(de->d_name, &oidchars,
+ if (!parse_filename_for_nontemp_relation(de->d_name, &relnumchars,
&forkNum))
continue;
@@ -235,11 +235,11 @@ ResetUnloggedRelationsInDbspaceDir(const char *dbspacedirname, int op)
while ((de = ReadDir(dbspace_dir, dbspacedirname)) != NULL)
{
ForkNumber forkNum;
- int oidchars;
+ int relnumchars;
unlogged_relation_entry ent;
/* Skip anything that doesn't look like a relation data file. */
- if (!parse_filename_for_nontemp_relation(de->d_name, &oidchars,
+ if (!parse_filename_for_nontemp_relation(de->d_name, &relnumchars,
&forkNum))
continue;
@@ -285,13 +285,13 @@ ResetUnloggedRelationsInDbspaceDir(const char *dbspacedirname, int op)
while ((de = ReadDir(dbspace_dir, dbspacedirname)) != NULL)
{
ForkNumber forkNum;
- int oidchars;
- char oidbuf[OIDCHARS + 1];
+ int relnumchars;
+ char relnumbuf[OIDCHARS + 1];
char srcpath[MAXPGPATH * 2];
char dstpath[MAXPGPATH];
/* Skip anything that doesn't look like a relation data file. */
- if (!parse_filename_for_nontemp_relation(de->d_name, &oidchars,
+ if (!parse_filename_for_nontemp_relation(de->d_name, &relnumchars,
&forkNum))
continue;
@@ -304,10 +304,10 @@ ResetUnloggedRelationsInDbspaceDir(const char *dbspacedirname, int op)
dbspacedirname, de->d_name);
/* Construct destination pathname. */
- memcpy(oidbuf, de->d_name, oidchars);
- oidbuf[oidchars] = '0円';
+ memcpy(relnumbuf, de->d_name, relnumchars);
+ relnumbuf[relnumchars] = '0円';
snprintf(dstpath, sizeof(dstpath), "%s/%s%s",
- dbspacedirname, oidbuf, de->d_name + oidchars + 1 +
+ dbspacedirname, relnumbuf, de->d_name + relnumchars + 1 +
strlen(forkNames[INIT_FORKNUM]));
/* OK, we're ready to perform the actual copy. */
@@ -328,12 +328,12 @@ ResetUnloggedRelationsInDbspaceDir(const char *dbspacedirname, int op)
while ((de = ReadDir(dbspace_dir, dbspacedirname)) != NULL)
{
ForkNumber forkNum;
- int oidchars;
- char oidbuf[OIDCHARS + 1];
+ int relnumchars;
+ char relnumbuf[OIDCHARS + 1];
char mainpath[MAXPGPATH];
/* Skip anything that doesn't look like a relation data file. */
- if (!parse_filename_for_nontemp_relation(de->d_name, &oidchars,
+ if (!parse_filename_for_nontemp_relation(de->d_name, &relnumchars,
&forkNum))
continue;
@@ -342,10 +342,10 @@ ResetUnloggedRelationsInDbspaceDir(const char *dbspacedirname, int op)
continue;
/* Construct main fork pathname. */
- memcpy(oidbuf, de->d_name, oidchars);
- oidbuf[oidchars] = '0円';
+ memcpy(relnumbuf, de->d_name, relnumchars);
+ relnumbuf[relnumchars] = '0円';
snprintf(mainpath, sizeof(mainpath), "%s/%s%s",
- dbspacedirname, oidbuf, de->d_name + oidchars + 1 +
+ dbspacedirname, relnumbuf, de->d_name + relnumchars + 1 +
strlen(forkNames[INIT_FORKNUM]));
fsync_fname(mainpath, false);
@@ -372,13 +372,13 @@ ResetUnloggedRelationsInDbspaceDir(const char *dbspacedirname, int op)
* for a non-temporary relation and false otherwise.
*
* NB: If this function returns true, the caller is entitled to assume that
- * *oidchars has been set to the a value no more than OIDCHARS, and thus
- * that a buffer of OIDCHARS+1 characters is sufficient to hold the OID
- * portion of the filename. This is critical to protect against a possible
- * buffer overrun.
+ * *relnumchars has been set to a value no more than OIDCHARS, and thus
+ * that a buffer of OIDCHARS+1 characters is sufficient to hold the
+ * RelFileNumber portion of the filename. This is critical to protect against
+ * a possible buffer overrun.
*/
bool
-parse_filename_for_nontemp_relation(const char *name, int *oidchars,
+parse_filename_for_nontemp_relation(const char *name, int *relnumchars,
ForkNumber *fork)
{
int pos;
@@ -388,7 +388,7 @@ parse_filename_for_nontemp_relation(const char *name, int *oidchars,
;
if (pos == 0 || pos > OIDCHARS)
return false;
- *oidchars = pos;
+ *relnumchars = pos;
/* Check for a fork name. */
if (name[pos] != '_')