summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund2020-10-30 23:38:41 +0000
committerAndres Freund2020-10-30 23:48:47 +0000
commitd52c28c3963be051e2e8350589905045d801c31e (patch)
tree78482789daa1e786430b4b5d51bc7a2b133f55c5
parente6fdd091fe0bde3ea4945b4a52d13b6a884c4f6a (diff)
fixup! aio: wip: concurrent WAL flushesaio-before-rebase-2020-10-30
-rw-r--r--src/backend/access/transam/xlog.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 3a14fbd8e4..8d18f2e486 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -3173,15 +3173,21 @@ write_out_wait:
static bool
XLogWriteIssueFlushes(XLogwrtRqst WriteRqst)
{
- /*
- * Could get here without having written ourselves, in which case we might
- * have no open file or the wrong one. However, we do not need to fsync
- * more than one file.
- */
- if ((sync_method != SYNC_METHOD_OPEN &&
- sync_method != SYNC_METHOD_OPEN_DSYNC &&
- enableFsync))
+ /* shouldn't even get here */
+ Assert(sync_method != SYNC_METHOD_OPEN &&
+ sync_method != SYNC_METHOD_OPEN_DSYNC);
+
+ if (!enableFsync)
{
+ LogwrtResult.FlushDone = LogwrtResult.FlushInit = LogwrtResult.WriteDone;
+ }
+ else
+ {
+ /*
+ * Could get here without having written ourselves, in which case we might
+ * have no open file or the wrong one. However, we do not need to fsync
+ * more than one file.
+ */
if (openLogFile >= 0 &&
!XLByteInPrevSeg(LogwrtResult.WriteDone, openLogSegNo,
wal_segment_size))
@@ -3223,15 +3229,15 @@ XLogWriteIssueFlushes(XLogwrtRqst WriteRqst)
XLogIOQueueCheck(XLogCtl->flushes);
}
+ }
- SpinLockAcquire(&XLogCtl->info_lck);
- XLogCtl->LogwrtResult = LogwrtResult;
- SpinLockRelease(&XLogCtl->info_lck);
+ SpinLockAcquire(&XLogCtl->info_lck);
+ XLogCtl->LogwrtResult = LogwrtResult;
+ SpinLockRelease(&XLogCtl->info_lck);
- /* signal that we need to wakeup walsenders later */
- // FIXME: also when using O_[D]SYNC?
- WalSndWakeupRequest();
- }
+ /* signal that we need to wakeup walsenders later */
+ // FIXME: also when using O_[D]SYNC?
+ WalSndWakeupRequest();
return false;
}
@@ -11442,7 +11448,9 @@ issue_xlog_fsync(int fd, XLogSegNo segno)
{
PgAioInProgress *aio;
- if (!enableFsync)
+ if (!enableFsync ||
+ sync_method == SYNC_METHOD_OPEN ||
+ sync_method == SYNC_METHOD_OPEN_DSYNC)
return;