https://opendal.apache.org/ logo
Libsql test migration
# general
f
I may need some help https://github.com/apache/incubator-opendal/pull/3363 here. Seems libsql problem?
x
Seems java binding should add libsql support.
And please note feature should not be surrounded by "
f
May I skip Java binding for libsql first?
x
No, we can’t
Maybe we can migrate other services first?
f
Yeah, this would be great
Seems, Java test always failed on the same position
My Local same(
x
Copy code
BlockingRenameTest(libsql).testBlockingRenameOverwrite() failed with:
org.apache.opendal.OpenDALException: Unexpected (temporary) at rename => {"error":"Internal Error: `Timed out while openning database connection`"}

Context:
   uri: http://127.0.0.1:8080/v2/pipeline
   response: Parts { status: 500, version: HTTP/1.1, headers: {"content-type": "application/json", "content-length": "74", "access-control-allow-origin": "*", "vary": "origin", "vary": "access-control-request-method", "vary": "access-control-request-headers", "date": "Mon, 23 Oct 2023 12:29:55 GMT"} }
   service: libsql
   from: b70c69eb-b44b-4d70-bd10-16cdd4fc1bf9
   to: 3418acdc-fab6-42b6-bf54-cc9a98e43429
No idea either. Will take a look later.
f
I'm trying to build libsql with custom argument local(they can not change some config via ENV or external file)
I find some clue, seems like root cause here. When I increae the count, the test would be pass
x
Maybe we should implement connection pool for libsql?
f
Yeah, I think this would be great. I will try it
emmm, I inspect the code again. I think connection pool may not solve the problem/ https://github.com/tursodatabase/libsql/issues/499 Maybe increase some limit would be a great idea for us.
x
I prefer have a better client instead of changing server side
128 connection and 1s timeout for creating db seem a good default.
f
SGTM
well, I do some test and got some conculsion 1. we already have connection pool for http protocol supported by reqwest 2. cargo nextest and maven test reach different behavior. We can monitor above 600 TCP connection in cargo nextest and only 8 in maven
demo4 for maven, demo5 for cargo
x
The test for test_copy_overwrite is slow too 🤔
PASS [ 1.057s] opendal::behavior behavior::test_blocking_copy_overwrite PASS [ 1.255s] opendal::behavior behavior::test_copy_overwrite
f
1s too fast
x
Copy code
rust
        if waiters_guard.waiters.load(Ordering::Relaxed) >= 128 {
            return Err(Error::TooManyRequests);
        }
        let fut = self.semaphore.clone().acquire_many_owned(units);
        let mut permit = match self.timeout {
            Some(t) => timeout(t, fut).await.map_err(|_| Error::DbCreateTimeout)?,
            None => fut.await,
        }
        .expect("semaphore closed");
I'm guessing the real problem is why libsql-server are holding so many connections.
f
That it true
x
Can you fetch the libsql-server's log?
f
so the fast way we can do is patch
no, they don't like to output enought log
x
There is not a hurry, we don't need to take fast way
f
But I will make a try(
x
The worst thing is leave libsql's workflow as is
, weired. cargo nextest has more concurrent requests than java maven test. Why java maven failed...
There is one thing we can improve: set the timeout error as temp error so that opendal can retry it.
Maybe we need to polish the libsql service's code base a little bit
For example, polish it's error handling logic.
f
Agree, maybe we need to open issue to continue a discussion
x
Great, let's raise an issue for the remaining work.
f
I think may the conccurency limit is working on per TCP session. cargo make the test parallelable, so per test per TCP session. And in Java, all test share the same TCP connection
x
Java binding doesn't have it own logic, all operations are handled by rust core.
Which means all of them will share the same HTTP connection pool logic.
x
We can fix this first.
f
I think we should not take care this in opendal actually, because 500 may means other problems, except we hard code some exception message to speliase some retry logic for this services
we do not timeout to the libsql server actually, the libsql server raise the exceptation actually
x
Negative, I'm talking opendal’s native retey layer support which based on temp errors returned by service.
It’s not a separate logic written for libsql.
No matter the cause, it’s a temporary error. We should mark it correctly to allow users to make correct decisions.
f
but I think we should not add a default retry layer for service. It should be decided by people who use it. Actually I have test it in Python, the behavior test works fine..
x
Our behavior test will enable retry layer by default. Users can decide on their own. It’s not default for everyone.
By the way, this is another topic. No matter making it default or not, services should return correct errors.
f
Yeah, services already return correct message (XD
x
No, temporary is not set in this case.
Those hints are important.
, seems libsql's error handling need more polish
f
yep...
@G_XD ping
x
By the way, not everyone is online at discord. For developement work, it's better to go to github instead.
Would you like to submit an issue for this?
f
yep
OK, the test has been fixed
2 Views