From b15319126a45ea3d50ed2fb95fca379edeff70c2 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Mon, 9 May 2016 15:07:08 +0200 Subject: [PATCH] Fix tests for MirroredBufferPool_Truncate() invocation MirroredBufferedPool_Truncate() returns a boolean so testing for (!returnvalue < 0) will always return false and not what we expect it to test. Github user fengttt. --- src/backend/storage/smgr/md.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index c729557e96..8c956bd857 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -1740,7 +1740,7 @@ mdtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp, bool allowNotFou */ BlockNumber lastsegblocks = nblocks - priorblocks; - if (!MirroredBufferPool_Truncate(&v->mdmir_open, lastsegblocks * BLCKSZ) < 0) + if (!MirroredBufferPool_Truncate(&v->mdmir_open, lastsegblocks * BLCKSZ)) ereport(ERROR, (errcode_for_file_access(), errmsg("could not truncate relation %u/%u/%u to %u blocks: %m", @@ -1764,7 +1764,7 @@ mdtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp, bool allowNotFou priorblocks += RELSEG_SIZE; } #else - if (!MirroredBufferPool_Truncate(&v->mdmir_open, nblocks * BLCKSZ) < 0) + if (!MirroredBufferPool_Truncate(&v->mdmir_open, nblocks * BLCKSZ)) ereport(ERROR, (errcode_for_file_access(), errmsg("could not truncate relation %u/%u/%u to %u blocks: %m", -- GitLab