Hi Magnus, I can't use riak-admin in a script like this, because Riak KV is not installed on the client containers.
Ah, I forgot that bucket listing was the same as key listing. I'll switch that to a different test. In this use case, though, it's not too important -- I'm trying to deal with unit tests that start up Riak fixtures via Docker. So there is literally no content in them to start up. Unfortunately, doing a simple HTTP request to /ping isn't sufficient to really tell if the Riak fixture has spun up properly, as sometimes it'll return OK to /ping, but still return errors on other requests. Do you know why there is this eight minute delay before RiakClient sees the node as good? It's not the Riak KV instance -- because if I cheat and put a ten second delay in, so that the very first attempt to scan for buckets succeeds, then things proceed instantly. On Mon, 22 May 2017 at 17:14 Magnus Kessler <mkess...@basho.com> wrote: > On 22 May 2017 at 07:02, Toby Corkindale <t...@dryft.net> wrote: > >> Hi, >> I've been trying to make a JVM-based app have better error recovery when >> the Riak cluster is still in a starting-up state. >> I have a fairly naive wait-loop that tries to connect and list buckets, >> and if there's an exception, retry again after a short delay. >> >> However once the Riak cluster comes good, the java client hangs on the >> first operation it makes, for a really long time. Minutes. >> -- in particular, at >> com.basho.riak.client.core.RiakCluster.retryOperation(RiakCluster.java:479) >> >> I've tried shutting down and recreating the RiakClient between attempts, >> but this doesn't seem to help. >> I guess the node manager has its own back-offs and delays.. Is there a >> way to reduce these timeouts? >> >> Thanks, >> Toby >> >> > Hi Toby, > > Using bucket listing as a method to determine live-ness is a really bad > idea. Bucket-listing, just as key-listing, requires a coverage query across > ALL objects stored in the cluster, and will take a really long time if the > cluster contains many objects. > > A better alternative would be to have a canary object with a known key, > that can be read quickly. > > In startup scripts, that need to wait until Riak KV is operational, we > recommend using `riak-admin wait-for-service riak_kv`. > > Kind Regards, > > Magnus > > -- > Magnus Kessler > Client Services Engineer > Basho Technologies Limited > > Registered Office - 8 Lincoln’s Inn Fields London WC2A 3BP Reg 07970431 >
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com