From 9322fb486253a5d79f254bd3928d5e7b4db34036 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 28 May 2013 04:44:46 +0200 Subject: [PATCH] bdr: mergme: Stat module improvements around increasing the number of nodes --- contrib/bdr/bdr_count.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/bdr/bdr_count.c b/contrib/bdr/bdr_count.c index 4b16732b52..4cd29be736 100644 --- a/contrib/bdr/bdr_count.c +++ b/contrib/bdr/bdr_count.c @@ -480,9 +480,11 @@ bdr_count_unserialize(void) read_size = sizeof(serial); if (read(fd, &serial, read_size) != read_size) { + int saved_errno = errno; LWLockRelease(BdrCountCtl->lock); CloseTransientFile(fd); - ereport(ERROR, + errno = saved_errno; + ereport(PANIC, (errcode_for_file_access(), errmsg("could not read bdr stat file data \"%s\": %m", path))); @@ -510,10 +512,12 @@ bdr_count_unserialize(void) } /* read actual data, directly into shmem */ - read_size = sizeof(BdrCountSlot) * bdr_count_nnodes; + read_size = sizeof(BdrCountSlot) * serial.nr_slots; if (read(fd, &BdrCountCtl->slots, read_size) != read_size) { + int saved_errno = errno; CloseTransientFile(fd); + errno = saved_errno; ereport(ERROR, (errcode_for_file_access(), errmsg("could not read bdr stat file data \"%s\": %m", -- 2.39.5