Assuming your backend is on LevelDB, have you try streaming the special bucket 2i index? We stream millions of keys using specific 2i indexes, if you didn't create any 2i index on your bucket, you can still fetch that special key, and per key you can fetch it one by one while iterating over your 2i index.

Sample code (Needs Riak Java client 1.4+ and Riak 1.4+):

/for (IndexEntry entry : bucket.fetchIndex(BucketIndex.index).executeStreaming()) {//
//
   // Then you fetch the key like this://
//   IRiakObject obj=bucket.fetch(entry.getObjectKey()).execute();//
//
// Or you could do the fetch and process operation using an ExecutorService.//
//  Future<Whatever> future=executorService.submit(new Callable<Whatever>//
//     public Whatever call(){
///IRiakObject obj=bucket.fetch(entry.getObjectKey()).execute();//
        .......
        return new Whatever OR null if Void
/     }
//////);//
//}/

HTH,

Guido.

On 05/12/13 18:46, Alexander Sicular wrote:
Shimon, chevreh, re-architect your app. Make like a key that has pointers to all of a given days keys or something like that and iterate over those.

If the sign says don't feed the animals, don't feed the animals.

Shalom v simcha,
-Alexander Sicular

@siculars

On Nov 28, 2013, at 7:00 AM, Shimon Benattar <shim...@gmail.com <mailto:shim...@gmail.com>> wrote:

Hi Riak users,


Unfortunately for me I need to implement the get all keys method in our system (I know it is not recommended)


I am developing classes with the Java Api and using the streaming option as following


StreamingOperation<String> keys = riakBucket.keys();

while (keys.hasNext()) {

final String next = keys.next();

out.write(next);

out.newLine();

}

riakBucket.keys().cancel();


My problem here is that for a simple class I inserted in Riak, after ~4.7 million keys I am getting a timeout from Riak.

Is there any way to configure the read operation timeout or to somehow catch the timeout and continue to receive the next keys (Can I somehow bulk read the keys)?


Thanks,


Shimon



_______________________________________________
riak-users mailing list
riak-users@lists.basho.com <mailto:riak-users@lists.basho.com>
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com



_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to