This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new a0110d54ef fix(services/tikv): fix dir marker stat and initial PD
discovery retry (#9017)
a0110d54ef is described below
commit a0110d54ef3bbe70977368acae35e6640f8fa86a
Author: Xuanwo <[email protected]>
AuthorDate: Wed Nov 25 14:13:54 2026 +0800
fix(services/tikv): fix dir marker stat and initial PD discovery retry
(#9017)
* fix(services/tikv): validate endpoints/TLS at build, classify connect
errors, and fix dir/root metadata
* fix(services/tikv): narrow stat and PD retry fixes
---
core/services/tikv/src/backend.rs | 6 ++----
core/services/tikv/src/core.rs | 15 ++++++++++-----
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/core/services/tikv/src/backend.rs
b/core/services/tikv/src/backend.rs
index 30aab4479d..3907294321 100644
--- a/core/services/tikv/src/backend.rs
+++ b/core/services/tikv/src/backend.rs
@@ -179,10 +179,8 @@ impl Service for TikvBackend {
} else {
let bs = self.core.get(&p).await?;
match bs {
- Some(bs) => Ok(RpStat::new({
- let metadata = MetadataBuilder::file(bs.len() as u64);
- metadata.build()
- })),
+ Some(_) if p.ends_with('/') =>
Ok(RpStat::new(MetadataBuilder::dir().build())),
+ Some(bs) => Ok(RpStat::new(MetadataBuilder::file(bs.len() as
u64).build())),
None => Err(Error::new(ErrorKind::NotFound, "kv not found in
tikv")),
}
}
diff --git a/core/services/tikv/src/core.rs b/core/services/tikv/src/core.rs
index 8391c95630..1d7d1fdbae 100644
--- a/core/services/tikv/src/core.rs
+++ b/core/services/tikv/src/core.rs
@@ -115,13 +115,18 @@ impl TikvCore {
}
fn parse_error(ctx: ErrorContext, err: tikv_client::Error) -> Error {
- let (kind, message) = if ctx.service_operation.0 == "Connect" {
- (ErrorKind::ConfigInvalid, "invalid configuration")
- } else {
- (ErrorKind::Unexpected, "error from tikv")
+ let error = match (ctx.service_operation.0, &err) {
+ // tikv-client prefixes this internal error message with its source
location.
+ ("Connect", tikv_client::Error::InternalError { message })
+ if message.ends_with("PD cluster failed to respond") =>
+ {
+ Error::new(ErrorKind::Unexpected, "PD cluster failed to
respond").set_temporary()
+ }
+ ("Connect", _) => Error::new(ErrorKind::ConfigInvalid, "invalid
configuration"),
+ _ => Error::new(ErrorKind::Unexpected, "error from tikv"),
};
- Error::new(kind, message)
+ error
.with_context("service", TIKV_SCHEME)
.with_context("service_operation", ctx.service_operation.0)
.set_source(err)