I’m trying to use the tap message api to do online back up for couchbase. The backfill api seems useful because when the backup program stoped, it can be resumed from the stop time using backfill. I tried the following code:
RequestMessage msg = null; MessageBuilder builder = new MessageBuilder();builder.doBackfill((Calendar.getInstance().getTimeInMillis() - (30 * 24 * 3600 * 1000)));
msg = builder.getMessage();
tapClient.tapCustom("noname", msg);
while (tapClient.hasMoreMessages()) {
ResponseMessage responseMsg = tapClient.getNextMessage();
if (responseMsg == null) {
System.out.println("Nothing dumped for last second");
continue;
}
System.out.println( "key:" + responseMsg.getKey() +
"\nvalue:" + new String(responseMsg.getValue()) + "\nvbucket:" + responseMsg.getVbucket() );
}
tapClient.shutdown();
I thought this will give all the data set in last 30 days. However, it only gives the mutations set after the program is started.
Is there anything I did wrong ?
Couchbase server version is 2.0.0
Java sdk is 1.1.5 .