From: Andres Freund Date: Tue, 28 May 2013 02:44:46 +0000 (+0200) Subject: bdr: mergme: Stat module improvements around increasing the number of nodes X-Git-Tag: bdr/0.4~4 X-Git-Url: http://git.postgresql.org/gitweb/static/benefitdownload/file?a=commitdiff_plain;h=9322fb486253a5d79f254bd3928d5e7b4db34036;p=users%2Fandresfreund%2Fpostgres.git bdr: mergme: Stat module improvements around increasing the number of nodes --- 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",