Sibling resolver [JIRA: RCS-249]#1188
Conversation
|
Good update of original script on timeout by Taka: Fun = fun(Host, Port, B, K) ->
{ok, Pid} = riakc_pb_socket:start_link(Host, Port),
try
{ok, RiakObject} = riakc_pb_socket:get(Pid, B, K, [{r, all},{timeout, 60000*5}], 60000*5),
case lists:any(fun({_, <<>>}) -> true; ({MD, _}) -> dict:is_key(<<"X-Riak-Deleted">>, MD) =:= true end, riakc_obj:get_contents(RiakObject)) of
true ->
VClock = riakc_obj:vclock(RiakObject),
ok = riakc_pb_socket:delete_vclock(Pid, B, K, VClock);
false ->
{Meta, Block} = hd(riakc_obj:get_contents(RiakObject)),
RO1 = riakc_obj:update_metadata(RiakObject, Meta),
RO2 = riakc_obj:update_value(RO1, Block),
ok = riakc_pb_socket:put(Pid, RO2,[{timeout, 60000*5}],60000*5)
end
after
riakc_pb_socket:stop(Pid)
end
end. |
There was a problem hiding this comment.
It's good to output time at start and end, which may help investigating timeout errors.
There was a problem hiding this comment.
Another subtle parameter in resolving (possibly) large object is custom timeout value. Using large (like 10min) timeout value by default or add it as the fourth argument so that user can specify it.
|
I would like to include Taka's awesome tool to this pull request. Pending to next sprint. |
|
Updated this branch; I believe I've addressed all your comments ^^;. |
There was a problem hiding this comment.
I prefer os:timestamp() unless monotonicity is needed.
There was a problem hiding this comment.
To align with timestamps in logs, I'd prefer calendar:universal_time(). thoughts?
|
Given that this function could be used via external scripts (not only console), I'll change all |
There was a problem hiding this comment.
false in second element represents there are no siblings (single value), right?
51331d1 to
c6249fa
Compare
* Add optional arguemnts on timeouts and put/get options * Add logs to indicate start/end time of each resolution attempt * Add logs to show numbers of siblings before trying to resolve them * Add test case of siblings resolver and log output
c6249fa to
53c0ac4
Compare
|
force-pushed 👿 |
There was a problem hiding this comment.
This does not work for multibag environment because riak_cs_riak_client does not know which bag it should use for manifest.
There was a problem hiding this comment.
Can we just take this function for single-bag cluster and tests?
There was a problem hiding this comment.
Ah, OK. Then I think three branches are not good because it wrongly looks like multibag ready. Just using master_pbc is sufficient.
There was a problem hiding this comment.
This log line is to indicate error occurrence. Is it better to include the word "error" (or "ERROR" or "fail" ...) for grep'pability?
There was a problem hiding this comment.
I don't think so, if that's error it should have log level as error but this is manual operation tool so I assume the operator's watching the log and see it. If needed, it should be grep'd with Not updating .
|
Updated |
|
Simple and effective 👍 |
Sibling resolver [JIRA: RCS-249] Reviewed-by: shino
|
@borshop merge |
|
For release note: Add a generic function for manual operations to resolve siblings of manifests and blocks _[posted via JIRA by Kota Uenishi]_ |
This is very well tested. Not really.