Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xact.c28
-rw-r--r--src/bin/pg_dump/pg_backup_directory.c11
-rw-r--r--src/include/access/xact.h1
3 files changed, 8 insertions, 32 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 2e67e998adb..b885513f765 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1045,34 +1045,6 @@ TransactionStartedDuringRecovery(void)
}
/*
- * GetTopReadOnlyTransactionNestLevel
- *
- * Note: this will return zero when not inside any transaction or when neither
- * a top-level transaction nor subtransactions are read-only, one when the
- * top-level transaction is read-only, two when one level of subtransaction is
- * read-only, etc.
- *
- * Note: subtransactions of the topmost read-only transaction are also
- * read-only, because they inherit read-only mode from the transaction, and
- * thus can't change to read-write mode. See check_transaction_read_only().
- */
-int
-GetTopReadOnlyTransactionNestLevel(void)
-{
- TransactionState s = CurrentTransactionState;
-
- if (!XactReadOnly)
- return 0;
- while (s->nestingLevel > 1)
- {
- if (!s->prevXactReadOnly)
- return s->nestingLevel;
- s = s->parent;
- }
- return s->nestingLevel;
-}
-
-/*
* EnterParallelMode
*/
void
diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_backup_directory.c
index 21b00792a8a..bc2a2fb4797 100644
--- a/src/bin/pg_dump/pg_backup_directory.c
+++ b/src/bin/pg_dump/pg_backup_directory.c
@@ -412,10 +412,15 @@ _LoadLOs(ArchiveHandle *AH, TocEntry *te)
/*
* Note: before archive v16, there was always only one BLOBS TOC entry,
- * now there can be multiple. We don't need to worry what version we are
- * reading though, because tctx->filename should be correct either way.
+ * now there can be multiple. Furthermore, although the actual filename
+ * was always "blobs.toc" before v16, the value of tctx->filename did not
+ * match that before commit 548e50976 fixed it. For simplicity we assume
+ * it must be "blobs.toc" in all archives before v16.
*/
- setFilePath(AH, tocfname, tctx->filename);
+ if (AH->version < K_VERS_1_16)
+ setFilePath(AH, tocfname, "blobs.toc");
+ else
+ setFilePath(AH, tocfname, tctx->filename);
CFH = ctx->LOsTocFH = InitDiscoverCompressFileHandle(tocfname, PG_BINARY_R);
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 7f11b919799..b2bc10ee041 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -458,7 +458,6 @@ extern TimestampTz GetCurrentTransactionStopTimestamp(void);
extern void SetCurrentStatementStartTimestamp(void);
extern int GetCurrentTransactionNestLevel(void);
extern bool TransactionIdIsCurrentTransactionId(TransactionId xid);
-extern int GetTopReadOnlyTransactionNestLevel(void);
extern void CommandCounterIncrement(void);
extern void ForceSyncCommit(void);
extern void StartTransactionCommand(void);