From 2507c2bbf312ba34200719842997f5d272d71777 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 9 Jul 2018 23:42:06 +0200 Subject: [SERVER] Introduce backgroundReplication=hashblock This is a compromise; if you want to validate replicated data fairly quickly, using this option will make background replication only kick in when there's a "dirty" 16M block, i.e. some blocks within a 16M block are cached locally, but not all. Completing the block makes it possible to validate its CRC32 checksum. --- src/server/globals.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/server/globals.h') diff --git a/src/server/globals.h b/src/server/globals.h index 2fd1af2..e82ea1b 100644 --- a/src/server/globals.h +++ b/src/server/globals.h @@ -67,6 +67,7 @@ struct _dnbd3_connection bool replicatedLastBlock; // bool telling if the last block has been replicated yet bool cycleDetected; // connection cycle between proxies detected for current remote server int nextReplicationIndex; // Which index in the cache map we should start looking for incomplete blocks at + // If BGR == BGR_HASHBLOCK, -1 means "currently no incomplete block" uint64_t replicationHandle; // Handle of pending replication request uint64_t bytesReceived; // Number of bytes received by the connection. uint64_t lastBytesReceived; // Number of bytes received last time we updated the global counter. @@ -205,7 +206,10 @@ extern bool _closeUnusedFd; * Should we replicate incomplete images in the background? * Otherwise, only blocks that were explicitly requested will be cached. */ -extern bool _backgroundReplication; +extern int _backgroundReplication; +#define BGR_DISABLED (0) +#define BGR_FULL (1) +#define BGR_HASHBLOCK (2) /** * Minimum connected clients for background replication to kick in -- cgit v1.2.3-55-g7522