diff options
author | Avra Sengupta <asengupt@redhat.com> | 2016-06-23 12:15:22 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-11-08 11:25:25 -0800 |
commit | 3e50e09723e024cd451c5f48a153fef0fe4857c7 (patch) | |
tree | de1ef8f66ff17eb2791fb406e122486da8cfe463 /xlators/experimental/fdl/src/gen_fdl.py | |
parent | 3e980c5eff495725e7c01793451bc81fd6f94ad5 (diff) |
jbr: Sending rollback from failed fop to fdl
In case of a failed fop, the failure is detected
by the leader in the jbr-server in two places. First
during a quorum check of +ve responses when it
receives responses from all the followers. At this
point if the fop hasn't been successfully journaled
at a quorum of followers (as in there is no merit in
trying the fop in the leader as the quorum will never
be met), then we fail the fop.
Also if this quorum is met, then the fop is tried on
the leader, and after the leader completes the fop
a quorum check similar to the previous one is done
again, this time including the leaders outcome. If
quorum is not met, then we fail the fop.
In both these cases, when the fop fails we send a -ve
ack to the client. With this patch, now we will also
send a rollback through a GF_FOP_IPC to all the followers(and
also to the leader in the second case of failure). This
rollback will contain the index and term number of the
fop which failed. This will be recorded in the respective
journals of the bricks and will be used to rollback the
fop on that brick later.
A subsequent write, and it's respective rollback would
look something like the following in the journal.
The trusted.jbr.term and trusted.jbr.index present in the
dict of both the logs, relate them, and the presence of
"rollback-fop" in the dict of IPC indicates that it is a
rollback fop, and the value 13(stands for GF_FOP_WRITE)
indicates what kind of rollback operation it is.
=== GF_FOP_WRITE
fd = <gfid 77f12ea2-ca56-40e3-a46e-ba2308baa035>
vector = <158 bytes>
offset = 0 (0x0)
flags = 32769 (0x8001)
xdata = dict {
trusted.jbr.term = 0 <2 bytes>
trusted.jbr.index = 4 <2 bytes>
}
=== GF_FOP_IPC
xdata = dict {
trusted.jbr.term = 0 <2 bytes>
trusted.jbr.index = 4 <2 bytes>
rollback-fop = 13 <3 bytes>
}
Change-Id: I70b6a143d20697153d58e2f719e34ecd1ed160a5
BUG: 1349385
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/14783
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/experimental/fdl/src/gen_fdl.py')
-rwxr-xr-x | xlators/experimental/fdl/src/gen_fdl.py | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/xlators/experimental/fdl/src/gen_fdl.py b/xlators/experimental/fdl/src/gen_fdl.py index 7f6b1aaaeaa..d59f12a4841 100755 --- a/xlators/experimental/fdl/src/gen_fdl.py +++ b/xlators/experimental/fdl/src/gen_fdl.py @@ -300,19 +300,44 @@ def get_special_subs (args): ser_code += ser_tmpl.replace("@SRC@",src) return len_code, ser_code +# Mention those fops in the selective_generate table, for which +# only a few common functions will be generated, and mention those +# functions. Rest of the functions can be customized +selective_generate = { + "ipc": "len,serialize", + } + def gen_fdl (): entrypoints = [] for name, value in ops.iteritems(): if "journal" not in [ x[0] for x in value ]: continue + + # generate all functions for all the fops + # except for the ones in selective_generate for which + # generate only the functions mentioned in the + # selective_generate table + gen_funcs = "len,serialize,callback,continue,fop" + if name in selective_generate: + gen_funcs = selective_generate[name].split(",") + len_code, ser_code = get_special_subs(value) fop_subs[name]["@LEN_CODE@"] = len_code[:-1] fop_subs[name]["@SER_CODE@"] = ser_code[:-1] - print generate(LEN_TEMPLATE,name,fop_subs) - print generate(SER_TEMPLATE,name,fop_subs) - print generate(CBK_TEMPLATE,name,cbk_subs) - print generate(CONTINUE_TEMPLATE,name,fop_subs) - print generate(FOP_TEMPLATE,name,fop_subs) + if 'len' in gen_funcs: + print generate(LEN_TEMPLATE,name,fop_subs) + if 'serialize' in gen_funcs: + print generate(SER_TEMPLATE,name,fop_subs) + if name == 'writev': + print "#define DESTAGE_ASYNC" + if 'callback' in gen_funcs: + print generate(CBK_TEMPLATE,name,cbk_subs) + if 'continue' in gen_funcs: + print generate(CONTINUE_TEMPLATE,name,fop_subs) + if 'fop' in gen_funcs: + print generate(FOP_TEMPLATE,name,fop_subs) + if name == 'writev': + print "#undef DESTAGE_ASYNC" entrypoints.append(name) print "struct xlator_fops fops = {" for ep in entrypoints: |