From 07cc8679cdf3b29680f4f105d0222da168d8bfc1 Mon Sep 17 00:00:00 2001 From: Kevin Vigor Date: Tue, 21 Mar 2017 08:23:25 -0700 Subject: Halo Replication feature for AFR translator Summary: Halo Geo-replication is a feature which allows Gluster or NFS clients to write locally to their region (as defined by a latency "halo" or threshold if you like), and have their writes asynchronously propagate from their origin to the rest of the cluster. Clients can also write synchronously to the cluster simply by specifying a halo-latency which is very large (e.g. 10seconds) which will include all bricks. In other words, it allows clients to decide at mount time if they desire synchronous or asynchronous IO into a cluster and the cluster can support both of these modes to any number of clients simultaneously. There are a few new volume options due to this feature: halo-shd-latency: The threshold below which self-heal daemons will consider children (bricks) connected. halo-nfsd-latency: The threshold below which NFS daemons will consider children (bricks) connected. halo-latency: The threshold below which all other clients will consider children (bricks) connected. halo-min-replicas: The minimum number of replicas which are to be enforced regardless of latency specified in the above 3 options. If the number of children falls below this threshold the next best (chosen by latency) shall be swapped in. New FUSE mount options: halo-latency & halo-min-replicas: As descripted above. This feature combined with multi-threaded SHD support (D1271745) results in some pretty cool geo-replication possibilities. Operational Notes: - Global consistency is gaurenteed for synchronous clients, this is provided by the existing entry-locking mechanism. - Asynchronous clients on the other hand and merely consistent to their region. Writes & deletes will be protected via entry-locks as usual preventing concurrent writes into files which are undergoing replication. Read operations on the other hand should never block. - Writes are allowed from _any_ region and propagated from the origin to all other regions. The take away from this is care should be taken to ensure multiple writers do not write the same files resulting in a gfid split-brain which will require resolution via split-brain policies (majority, mtime & size). Recommended method for preventing this is using the nfs-auth feature to define which region for each share has RW permissions, tiers not in the origin region should have RO perms. TODO: - Synchronous clients (including the SHD) should choose clients from their own region as preferred sources for reads. Most of the plumbing is in place for this via the child_latency array. - Better GFID split brain handling & better dent type split brain handling (i.e. create a trash can and move the offending files into it). - Tagging in addition to latency as a means of defining which children you wish to synchronously write to Test Plan: - The usual suspects, clang, gcc w/ address sanitizer & valgrind - Prove tests Reviewers: jackl, dph, cjh, meyering Reviewed By: meyering Subscribers: ethanr Differential Revision: https://phabricator.fb.com/D1272053 Tasks: 4117827 Change-Id: I694a9ab429722da538da171ec528406e77b5e6d1 BUG: 1428061 Signed-off-by: Kevin Vigor Reviewed-on: http://review.gluster.org/16099 Reviewed-on: https://review.gluster.org/16177 Tested-by: Pranith Kumar Karampuri Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- xlators/protocol/client/src/client-handshake.c | 2 +- xlators/protocol/client/src/client.c | 98 ++++++++++++++------------ 2 files changed, 54 insertions(+), 46 deletions(-) (limited to 'xlators/protocol/client/src') diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index 447366c0deb..a36f6e435a7 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -1553,7 +1553,7 @@ client_query_portmap_cbk (struct rpc_req *req, struct iovec *iov, int count, voi rpc_clnt_reconfig (conf->rpc, &config); conf->skip_notify = 1; - conf->quick_reconnect = 1; + conf->quick_reconnect = 1; out: if (frame) diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index e8db8eed166..6cb5b6b38ca 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -464,7 +464,7 @@ int32_t client_forget (xlator_t *this, inode_t *inode) { /* Nothing here */ - return 0; + return 0; } int32_t @@ -542,7 +542,7 @@ out: STACK_UNWIND_STRICT (lookup, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL); - return 0; + return 0; } @@ -568,7 +568,7 @@ out: if (ret) STACK_UNWIND_STRICT (stat, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -597,7 +597,7 @@ out: STACK_UNWIND_STRICT (truncate, frame, -1, ENOTCONN, NULL, NULL, NULL); - return 0; + return 0; } @@ -625,7 +625,7 @@ out: if (ret) STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOTCONN, NULL, NULL, NULL); - return 0; + return 0; } @@ -654,7 +654,7 @@ out: if (ret) STACK_UNWIND_STRICT (access, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } @@ -684,7 +684,7 @@ out: if (ret) STACK_UNWIND_STRICT (readlink, frame, -1, ENOTCONN, NULL, NULL, NULL); - return 0; + return 0; } @@ -715,7 +715,7 @@ out: STACK_UNWIND_STRICT (mknod, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL, NULL); - return 0; + return 0; } @@ -745,7 +745,7 @@ out: STACK_UNWIND_STRICT (mkdir, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL, NULL); - return 0; + return 0; } @@ -775,7 +775,7 @@ out: STACK_UNWIND_STRICT (unlink, frame, -1, ENOTCONN, NULL, NULL, NULL); - return 0; + return 0; } int32_t @@ -804,7 +804,7 @@ out: STACK_UNWIND_STRICT (rmdir, frame, -1, ENOTCONN, NULL, NULL, NULL); - return 0; + return 0; } @@ -834,7 +834,7 @@ out: STACK_UNWIND_STRICT (symlink, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL, NULL); - return 0; + return 0; } @@ -864,7 +864,7 @@ out: STACK_UNWIND_STRICT (rename, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL, NULL, NULL); - return 0; + return 0; } @@ -894,7 +894,7 @@ out: STACK_UNWIND_STRICT (link, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL, NULL); - return 0; + return 0; } @@ -929,7 +929,7 @@ out: STACK_UNWIND_STRICT (create, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL, NULL, NULL); - return 0; + return 0; } @@ -962,7 +962,7 @@ out: if (ret) STACK_UNWIND_STRICT (open, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -997,7 +997,7 @@ out: STACK_UNWIND_STRICT (readv, frame, -1, ENOTCONN, NULL, 0, NULL, NULL, NULL); - return 0; + return 0; } @@ -1035,7 +1035,7 @@ out: if (ret) STACK_UNWIND_STRICT (writev, frame, -1, ENOTCONN, NULL, NULL, NULL); - return 0; + return 0; } @@ -1061,7 +1061,7 @@ out: if (ret) STACK_UNWIND_STRICT (flush, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } @@ -1090,7 +1090,7 @@ out: if (ret) STACK_UNWIND_STRICT (fsync, frame, -1, ENOTCONN, NULL, NULL, NULL); - return 0; + return 0; } @@ -1117,7 +1117,7 @@ out: if (ret) STACK_UNWIND_STRICT (fstat, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -1146,7 +1146,7 @@ out: if (ret) STACK_UNWIND_STRICT (opendir, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -1174,7 +1174,7 @@ out: if (ret) STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } @@ -1201,7 +1201,7 @@ out: if (ret) STACK_UNWIND_STRICT (statfs, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } static gf_boolean_t @@ -1390,7 +1390,7 @@ out: if (need_unwind) STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, NULL); - return 0; + return 0; } @@ -1420,7 +1420,7 @@ out: if (ret) STACK_UNWIND_STRICT (fsetxattr, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } @@ -1450,7 +1450,7 @@ out: if (ret) STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -1479,7 +1479,7 @@ out: if (ret) STACK_UNWIND_STRICT (getxattr, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -1509,7 +1509,7 @@ out: if (ret) STACK_UNWIND_STRICT (xattrop, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -1539,7 +1539,7 @@ out: if (ret) STACK_UNWIND_STRICT (fxattrop, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -1568,7 +1568,7 @@ out: if (ret) STACK_UNWIND_STRICT (removexattr, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } int32_t @@ -1595,7 +1595,7 @@ out: if (ret) STACK_UNWIND_STRICT (fremovexattr, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } int32_t @@ -1651,7 +1651,7 @@ out: if (ret) STACK_UNWIND_STRICT (lk, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -1681,7 +1681,7 @@ out: if (ret) STACK_UNWIND_STRICT (inodelk, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } @@ -1712,7 +1712,7 @@ out: if (ret) STACK_UNWIND_STRICT (finodelk, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } @@ -1744,7 +1744,7 @@ out: if (ret) STACK_UNWIND_STRICT (entrylk, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } @@ -1777,7 +1777,7 @@ out: if (ret) STACK_UNWIND_STRICT (fentrylk, frame, -1, ENOTCONN, NULL); - return 0; + return 0; } @@ -1806,7 +1806,7 @@ out: if (ret) STACK_UNWIND_STRICT (rchecksum, frame, -1, ENOTCONN, 0, NULL, NULL); - return 0; + return 0; } int32_t @@ -1837,7 +1837,7 @@ out: if (ret) STACK_UNWIND_STRICT (readdir, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -1869,7 +1869,7 @@ out: if (ret) STACK_UNWIND_STRICT (readdirp, frame, -1, ENOTCONN, NULL, NULL); - return 0; + return 0; } @@ -1898,7 +1898,7 @@ out: if (ret) STACK_UNWIND_STRICT (setattr, frame, -1, ENOTCONN, NULL, NULL, NULL); - return 0; + return 0; } int32_t @@ -1926,7 +1926,7 @@ out: if (ret) STACK_UNWIND_STRICT (fsetattr, frame, -1, ENOTCONN, NULL, NULL, NULL); - return 0; + return 0; } int32_t @@ -2152,7 +2152,7 @@ out: if (ret) STACK_UNWIND_STRICT (getspec, frame, -1, EINVAL, NULL); - return 0; + return 0; } @@ -2223,6 +2223,15 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, conf = this->private; switch (event) { + case RPC_CLNT_PING: + { + ret = default_notify (this, GF_EVENT_CHILD_PING, data); + if (ret) + gf_log (this->name, GF_LOG_INFO, + "CHILD_PING notify failed"); + conf->last_sent_event = GF_EVENT_CHILD_PING; + break; + } case RPC_CLNT_CONNECT: { conf->connected = 1; @@ -2314,7 +2323,6 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, } else { rpc->conn.config.remote_port = 0; - } break; @@ -2666,7 +2674,7 @@ reconfigure (xlator_t *this, dict_t *options) ret = 0; out: - return ret; + return ret; } -- cgit