Skip to content

make libsql Conn::is_autocommit synchronous#759

Merged
Horusiath merged 3 commits into
tursodatabase:mainfrom
Horusiath:libsql-sync-is_autocommit
Dec 18, 2023
Merged

make libsql Conn::is_autocommit synchronous#759
Horusiath merged 3 commits into
tursodatabase:mainfrom
Horusiath:libsql-sync-is_autocommit

Conversation

@Horusiath

Copy link
Copy Markdown
Contributor

Potential rollback, depending on the result of discussion from #758 .

The original decision to change was this discussion: #653 (comment)

@MarinPostma MarinPostma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should do that, rather, we should accurately report whether a connection is in auto-commit state, either by tracking the state, or querying the server

Comment thread libsql/src/hrana/hyper.rs Outdated
@Horusiath Horusiath force-pushed the libsql-sync-is_autocommit branch from 4f80717 to 3063801 Compare December 12, 2023 12:45
// The `libsql://` protocol is an alias for `https://`.
let base_url = coerce_url_scheme(&url);
let url_for_queries = format!("{base_url}/v2/pipeline");
let url_for_queries = format!("{base_url}/v3/pipeline");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetAutocommitReq requires Hrana v3 to be used.

@penberg penberg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible to me, but it's best to get explicit ACK from @MarinPostma and/or @LucioFranco.

Comment thread libsql/src/hrana/stream.rs Outdated
Comment on lines +278 to +279
let [resp, _, get_autocommit] = self
.send_requests([req, StreamRequest::GetAutocommit, StreamRequest::Close])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't the results in the wrong order? 🤔

Suggested change
let [resp, _, get_autocommit] = self
.send_requests([req, StreamRequest::GetAutocommit, StreamRequest::Close])
let [resp, get_autocommit, _] = self
.send_requests([req, StreamRequest::GetAutocommit, StreamRequest::Close])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind adding a sim test?

@Horusiath Horusiath Dec 16, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tested - and changing the order causes some of the tests to fail - hence I flipped the order. I found this pretty weird myself.

@Horusiath Horusiath added this pull request to the merge queue Dec 18, 2023
Merged via the queue into tursodatabase:main with commit e8500de Dec 18, 2023
@Horusiath Horusiath deleted the libsql-sync-is_autocommit branch December 18, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants