marklogic / marklogic/java-client-api
Non-Retryable requests when transactions are being used?
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 61
- 派生
- 74
- 平均合并
- 2 天 53 分钟
- 30 天内合并 PR
- 8
描述
We run our integration tests in gitlab in a dockerized environment, and since we started to use MarkLogic server transactions more we noticed our tests behaving increasingly flaky. We suspect the dockerized environment to induce some connection and availability issues. Here is a stacktrace of one of the issues:
com.marklogic.client.FailedRetryException: Service unavailable and maximum retry period elapsed: 0 seconds after 0 retries
at com.marklogic.client.impl.OkHttpServices.sendRequestWithRetry(OkHttpServices.java:576)
at com.marklogic.client.impl.OkHttpServices.headImplExec(OkHttpServices.java:1054)
at com.marklogic.client.impl.OkHttpServices.headImpl(OkHttpServices.java:1016)
at com.marklogic.client.impl.OkHttpServices.head(OkHttpServices.java:972)
at com.marklogic.client.impl.DocumentManagerImpl.exists(DocumentManagerImpl.java:145)
The code leading into this trace is supposed to check, whether a document exists and looks like this:
final DocumentDescriptor documentDescriptor = manager.exists(docUri.toString(), transaction);
The transaction is non-null in the above statement. And as it turns out the OkHttpServices in line 1054:
return sendRequestWithRetry(requestBldr, (transaction == null), doHeadFunction, null);
renders a request using a transaction being "not retryable".
In a distributed system communication errors can happen, regardless of whether a transaction is being used or not. There should be a destinction being made depending on the type of error, whether it makes sense to repeat a request. The existence of a transaction should not make a difference here.
(We are currently using the marklogic-java-client in version 8.0.0 and the Markogic Server in 11.3.1)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 OkHttpServices.sendRequestWithRetry 及其调用方开始,尤其是 headImplExec 和 DocumentManagerImpl.exists,并将堆栈跟踪和事务参数作为切入点。检查现有的重试行为以及针对暂时性服务故障的测试。当重试决策能够区分通信错误和事务处理,并通过回归测试覆盖事务性 exists 请求时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100