间歇性地:Couchbase保存未发生

问题描述

我将Couchbase Java sdk客户端2.7.11与Couchbase 6.0社区添加一起使用。在执行upsert时,它会给我成功的响应,但是当我获取文档或通过Couchbase UI查看时,它不可用。

//getClient returning me "api com.couchbase.client.java.Bucket" instance
  private static final retrywhenFunction RETRY_POLICY = 
        RetryBuilder.anyOf( TimeoutException.class,TemporaryFailureException.class,RequestCancelledException.class,BackpressureException.class,CASMismatchException.class)
        .delay(Delay.exponential(TimeUnit.MILLISECONDS,50))
        .max(3)
        .build();

int expiryTime = Instant.Now().getEpochSecond() + (10 * 60);
StringDocument document = StringDocument.create("ABC_Test",expiryTime,"SomeValue");
StringDocument savedDocument = getClient().async().upsert(document).retrywhen(RETRY_POLICY)
    .doOnError(exception -> {
        String msg = "Unable to update a document = " + exception.getMessage();
        LOGGER.error(()->msg);
    })
    .doOnCompleted(() -> LOGGER.debug(()-> "Succesfully saved document with key \"" + key))
    .doAfterTerminate(() -> LOGGER.debug(()-> "Processing save document with key \"" + key + "\" Completed."))
    .toBlocking()
    .singleOrDefault(null);
    
    if(savedDocument==null) {
        LOGGER.error(()-> "Document with id Couldn't be saved: " + key);
    } else {
        LOGGER.debug(()-> "Saved document: \n" + savedDocument);
    }

当尝试使用QueuePush时,我遇到了类似的问题。 Queue推送给了我成功的响应,但是Queue pop提示队列本身不存在。我打算在接下来的5秒钟内使用这两种保存方式。我没有任何负载测试在运行,这可能表明存在异步延迟行为。

//expirationTime is quiet ahead in future.

getClient().async()
    .queuePush(queueName,queueElement,MutationoptionBuilder.builder().createDocument(true).expiry(expirationTime))
    .retrywhen(RETRY_POLICY)
    .doOnError(exception -> LOGGER.error(() -> “Unable to add element '”+ queueElement +"’ in queue ‘" + queueName +
    "’ Exception = " + exception.getMessage()))
    .doOnCompleted(() -> LOGGER.debug(()-> "Succesfully saved document in queue “” + queueName))
    .doAfterTerminate(latch::countDown).subscribe();

以上两种情况都被间歇性地注意到。您能建议诊断一下吗?社区版本是否具有启用文档级审核的方法? 我也已在Couchbase论坛上发布了类似的问题,试图将其带给更大的受众群体https://forums.couchbase.com/t/intermittently-couchbase-save-not-happening/28006,并找到正确的方向。

先谢谢您。 问候

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)