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 ec0dcd20b fix: sqlite may dead lock in ci (#5738)
ec0dcd20b is described below
commit ec0dcd20b2a168bf2a4381d1fbfb85f744178dd6
Author: yihong <[email protected]>
AuthorDate: Tue Mar 11 22:54:59 2025 +0800
fix: sqlite may dead lock in ci (#5738)
* fix: sqlite may dead lock in ci
Signed-off-by: yihong0618 <[email protected]>
* fix: lint things
Signed-off-by: yihong0618 <[email protected]>
* fix: use temp error and add co-author
Signed-off-by: yihong0618 <[email protected]>
Co-authored-by: Xuanwo <[email protected]>
* fix: lint
Signed-off-by: yihong0618 <[email protected]>
* fix: address comments and make the code simple and easy to understand
Signed-off-by: yihong0618 <[email protected]>
* fix: happy the clippy
Signed-off-by: yihong0618 <[email protected]>
---------
Signed-off-by: yihong0618 <[email protected]>
Co-authored-by: Xuanwo <[email protected]>
---
core/src/services/sqlite/backend.rs | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/core/src/services/sqlite/backend.rs
b/core/src/services/sqlite/backend.rs
index a6bfeb35d..cfda82bc1 100644
--- a/core/src/services/sqlite/backend.rs
+++ b/core/src/services/sqlite/backend.rs
@@ -308,5 +308,20 @@ impl kv::Adapter for Adapter {
}
fn parse_sqlite_error(err: sqlx::Error) -> Error {
- Error::new(ErrorKind::Unexpected, "unhandled error from
sqlite").set_source(err)
+ let is_temporary = matches!(
+ &err,
+ sqlx::Error::Database(db_err) if db_err.code().is_some_and(|c| c ==
"5" || c == "6")
+ );
+
+ let message = if is_temporary {
+ "database is locked or busy"
+ } else {
+ "unhandled error from sqlite"
+ };
+
+ let mut error = Error::new(ErrorKind::Unexpected, message).set_source(err);
+ if is_temporary {
+ error = error.set_temporary();
+ }
+ error
}