From: Jonathan Davies <jonathan.davies@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Jonathan Davies <jonathan.davies@citrix.com>,
Jon Ludlam <jonathan.ludlam@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Euan Harris <euan.harris@citrix.com>,
Dave Scott <dave@recoil.org>
Subject: [PATCH 7/7] oxenstored: log request and response during transaction replay
Date: Thu, 17 Mar 2016 17:51:15 +0000 [thread overview]
Message-ID: <1458237075-13777-8-git-send-email-jonathan.davies@citrix.com> (raw)
In-Reply-To: <1458237075-13777-1-git-send-email-jonathan.davies@citrix.com>
During a transaction replay, the replayed requests and the new responses are
logged in the same way as the original requests and the original responses.
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jon Ludlam <jonathan.ludlam@citrix.com>
Reviewed-by: Euan Harris <euan.harris@citrix.com>
---
tools/ocaml/xenstored/process.ml | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 6d1f551..fb5fdaf 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -281,6 +281,18 @@ let input_handle_error ~cons ~doms ~fct ~con ~t ~req =
| (Failure "int_of_string") -> reply_error "EINVAL"
| Define.Unknown_operation -> reply_error "ENOSYS"
+let write_access_log ~ty ~tid ~con ~data =
+ Logging.xb_op ~ty ~tid ~con data
+
+let write_answer_log ~ty ~tid ~con ~data =
+ Logging.xb_answer ~ty ~tid ~con data
+
+let write_response_log ~ty ~tid ~con ~response =
+ match response with
+ | Packet.Ack _ -> write_answer_log ~ty ~tid ~con ~data:""
+ | Packet.Reply x -> write_answer_log ~ty ~tid ~con ~data:x
+ | Packet.Error e -> write_answer_log ~ty:(Xenbus.Xb.Op.Error) ~tid ~con ~data:e
+
(* Replay a stored transaction against a fresh store, check the responses are
all equivalent: if so, commit the transaction. Otherwise send the abort to
the client. *)
@@ -294,8 +306,10 @@ let transaction_replay c t doms cons =
let new_t = Transaction.make tid cstore in
let con = sprintf "r(%d):%s" id (Connection.get_domstr c) in
let perform_exn (request, response) =
+ write_access_log ~ty:request.Packet.ty ~tid ~con ~data:request.Packet.data;
let fct = function_of_type_simple_op request.Packet.ty in
let response' = input_handle_error ~cons ~doms ~fct ~con:c ~t:new_t ~req:request in
+ write_response_log ~ty:request.Packet.ty ~tid ~con ~response:response';
if not(Packet.response_equal response response') then raise Transaction_again in
finally
(fun () ->
@@ -451,12 +465,6 @@ let process_packet ~store ~cons ~doms ~con ~req =
error "process packet: %s" (Printexc.to_string exn);
Connection.send_error con tid rid "EIO"
-let write_access_log ~ty ~tid ~con ~data =
- Logging.xb_op ~ty ~tid ~con:(Connection.get_domstr con) data
-
-let write_answer_log ~ty ~tid ~con ~data =
- Logging.xb_answer ~ty ~tid ~con:(Connection.get_domstr con) data
-
let do_input store cons doms con =
let newpacket =
try
@@ -483,7 +491,7 @@ let do_input store cons doms con =
(Connection.get_domstr con) tid
(Xenbus.Xb.Op.to_string ty) (sanitize_data data); *)
process_packet ~store ~cons ~doms ~con ~req;
- write_access_log ~ty ~tid ~con ~data;
+ write_access_log ~ty ~tid ~con:(Connection.get_domstr con) ~data;
Connection.incr_ops con;
)
@@ -496,7 +504,7 @@ let do_output store cons doms con =
info "[%s] <- %s \"%s\""
(Connection.get_domstr con)
(Xenbus.Xb.Op.to_string ty) (sanitize_data data);*)
- write_answer_log ~ty ~tid ~con ~data;
+ write_answer_log ~ty ~tid ~con:(Connection.get_domstr con) ~data;
);
try
ignore (Connection.do_output con)
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-17 17:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 17:51 [PATCH 0/7] oxenstored: improve transaction conflict handling Jonathan Davies
2016-03-17 17:51 ` [PATCH 1/7] oxenstored: refactor putting response on wire Jonathan Davies
2016-03-17 17:51 ` [PATCH 2/7] oxenstored: remove some unused parameters Jonathan Davies
2016-03-17 17:51 ` [PATCH 3/7] oxenstored: refactor request processing Jonathan Davies
2016-03-24 22:22 ` Boris Ostrovsky
2016-03-24 22:49 ` Andrew Cooper
2016-03-24 23:57 ` Boris Ostrovsky
2016-03-29 9:08 ` Jonathan Davies
2016-03-29 12:45 ` Boris Ostrovsky
2016-03-29 16:38 ` Wei Liu
2016-03-29 19:41 ` David Scott
2016-03-30 15:46 ` Jonathan Davies
2016-03-30 15:53 ` Wei Liu
2016-03-17 17:51 ` [PATCH 4/7] oxenstored: keep track of each transaction's operations Jonathan Davies
2016-03-17 17:51 ` [PATCH 5/7] oxenstored: move functions that process simple operations Jonathan Davies
2016-03-17 17:51 ` [PATCH 6/7] oxenstored: replay transaction upon conflict Jonathan Davies
2016-03-17 17:51 ` Jonathan Davies [this message]
2016-03-18 14:33 ` [PATCH 0/7] oxenstored: improve transaction conflict handling Konrad Rzeszutek Wilk
2016-03-18 16:21 ` Jonathan Davies
2016-03-18 16:36 ` Wei Liu
2016-03-19 11:30 ` David Scott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458237075-13777-8-git-send-email-jonathan.davies@citrix.com \
--to=jonathan.davies@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dave@recoil.org \
--cc=euan.harris@citrix.com \
--cc=jonathan.ludlam@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).