500ms is aggressive enough to trigger split-brain under fairly
ordinary workloads, particularly for HVM. The long-term fix is to
integrate with a real HA monitor like linux HA.
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
#include <unistd.h>
/* timeout for reads and writes in ms */
-#define NET_TIMEOUT 500
+#define HEARTBEAT_MS 1000
#define RAMDISK_HASHSIZE 128
/* connect retry timeout (seconds) */
int rc;
size_t cur = 0;
struct timeval tv = {
- .tv_sec = 0,
- .tv_usec = NET_TIMEOUT * 1000
+ .tv_sec = HEARTBEAT_MS / 1000,
+ .tv_usec = (HEARTBEAT_MS % 1000) * 1000
};
if (!len)
size_t cur = 0;
int rc;
struct timeval tv = {
- .tv_sec = 0,
- .tv_usec = NET_TIMEOUT * 1000
+ .tv_sec = HEARTBEAT_MS / 1000,
+ .tv_usec = (HEARTBEAT_MS % 1000) * 1000
};
if (!len)
/* set when a consistent image is available */
static int completed = 0;
-#define HEARTBEAT_MS 500
+#define HEARTBEAT_MS 1000
#ifndef __MINIOS__
static ssize_t read_exact_timed(int fd, void* buf, size_t size)
{
if ( completed ) {
/* expect a heartbeat every HEARBEAT_MS ms maximum */
- tv.tv_sec = 0;
- tv.tv_usec = HEARTBEAT_MS * 1000;
+ tv.tv_sec = HEARTBEAT_MS / 1000;
+ tv.tv_usec = (HEARTBEAT_MS % 1000) * 1000;
FD_ZERO(&rfds);
FD_SET(fd, &rfds);