couchbase - 间歇性地:Couchbase Save 没有发生
问题描述
我正在使用带有 Couchbase 6.0 社区添加的 Couchbase java sdk 客户端 2.7.11。在执行 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 时遇到了类似的问题。队列推送给了我成功响应,但队列弹出说队列本身不存在。我打算在接下来的 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并获得正确的方向。
先感谢您。问候
解决方案
推荐阅读
- javascript - 快速变化时反应状态重置/表现不佳
- jsp - 如何从查询参数中获取授权代码 // Amazon Cognito 授权端点
- scala - Scala Spark 创建多个列
- windows - 如何在 Windows CMD 中永久设置 PATH?
- php - WordPress 查找具有特定元值的帖子的 ID
- reactjs - 反应.JS | create-react-app 加载时间非常长,制作一个 react 应用程序需要一个小时
- spring - Spring Webflux:我是否需要捕获(Throwable)来触发 Mono.doOnError?
- spring - 在构建查询时休眠添加 Id 列字段
- java - 如何在休眠中使用 pg_column_size?
- c - 执行或启动调试模式后 Eclipse CDT 错误 193