Java client 2i question...

Guido Medina guido.medina at
Thu Jan 31 11:36:13 EST 2013

I was able to resolve this with the following:

/for(String key : 

There is a catch though, if you have a bucket with keys big enough, this 
will crash your cluster ($bucket 2i seems to do something similar to the 
not recommended listKeys() MR function), so our solution was to use an 
existing 2i to list the keys, so my recommendation is that whatever you 
do, mark your keys with at least one 2i so that you can list the keys 
later using such 2i.

Hope that helps anyone needing to list the keys, again, don't list the 
keys nor use $bucket special 2i index, it might for some buckets kill 
your cluster, if you didn't create any 2i on some bucket, avoid listing 
the keys unless are too few, if your keys are based on a sequences then 
use that to get to your keys and try to index them if you ever need to 
do a programmatic repair (Say you want to get rid of keys no longer in use)

In our case we needed to add some new indexes and remove deprecated 
ones, so we use the deprecated index to iterate thru the keys, then 
remove the old indexes and add the new ones.

/Hope our experiences help someone out there//,/


On 29/01/13 18:44, Guido Medina wrote:
> Hi,
> On our presentation of how Temetra uses Riak on Dublin, we were told 
> there was a special index which can list me the keys on a bucket using 
> a 2i search, if so, does anyone has any code sample using the Java 
> client to do that? Something like $[bucket _name] index?
> If so, is there any danger on adopting such undocumented 
> functionality? Like LevelDB or Riak core would remove it or deprecate it.
> Regards,
> Guido.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list