Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction API issues #2082

Closed
benjaminwinger opened this issue Sep 25, 2023 · 3 comments · Fixed by #2865
Closed

Transaction API issues #2082

benjaminwinger opened this issue Sep 25, 2023 · 3 comments · Fixed by #2865
Assignees
Labels
bug Something isn't working high-priority transactions Transaction management related issues usability Issues related to better usability experience, including bad error messages

Comments

@benjaminwinger
Copy link
Collaborator

When testing the integer bitpacking, I added a test which inserts many nodes at once (NodeInsertionDeletionTests.InsertManyNodesTest). This is rather slow (inserting NODE_GROUP_SIZE values took 75 seconds), so I tried to speed it up by doing it all as one transaction rather than one automatic transaction for each insert, but that resulted in a hang, or at least it was taking much longer than 75 seconds, even for smaller sizes like the 4096 values I ended up using (which still takes a few seconds).

Note that this was reproducible on the master branch prior to my bitpacking changes in #2004.

In addition, inserting values in small chunks would cause a Buffer manager exception: Failed to claim a frame error.
This would occur even with just one value (I also tested on chunks of 2, 5 and 10) inserted between calling Connection::beginWriteTransaction and Connection::commit (after many inserts at least, the other test in NodeInsertionDeletionTests proves that it at least works the first few times).

Tests that reproduce both of these issues can be found in this commit.

@benjaminwinger
Copy link
Collaborator Author

benjaminwinger commented Sep 26, 2023

It seems like the issue was that beginWriteTransaction was called during initialization so when it's called the second time it silently fails, and then hangs when the inserts are done.

Regarding the silent failure of Connection::beginWriteTransaction, partly it's just that Connection::beginWriteTransaction doesn't actually return a query result, so you can't check that it's successful or see the error message (without querying BEGIN WRITE TRANSACTION manually), but I think it's also part of a broader issue with the C++ API and how it handles results in general. Using [[nodiscard]] would probably help, as well as maybe a QueryResult::assertSuccess method that would turn error messages into exceptions, and in this case I think we would want beginWriteTransaction to just directly call assertSuccess rather than producing a result.

The hang on the other hand is contrary to what the error message says here.

With the double call fixed, doing the inserts all as one transaction works identically to how it's currently working (where I guess it's doing it all as one transaction and auto comitting/discarding when the connection goes out of scope).

Doing 4096 explicit (or implicit) transactions is still failing with the buffer manager exception, but it does work if broken up into chunks so that fewer transactions are done (I tested with chunks of 10, so 410 transactions).

@benjaminwinger benjaminwinger changed the title Hangs and crashes when inserting many nodes at once when using explicit transactions Transaction issues Sep 26, 2023
@semihsalihoglu-uw semihsalihoglu-uw added bug Something isn't working high-priority transactions Transaction management related issues labels Jan 8, 2024
@semihsalihoglu-uw semihsalihoglu-uw changed the title Transaction issues Transaction bugs Jan 8, 2024
@semihsalihoglu-uw semihsalihoglu-uw changed the title Transaction bugs Transaction bugs/issues Jan 8, 2024
@semihsalihoglu-uw
Copy link
Contributor

I'm linking this issue to this other issue that relates to returning error statuses in the C API: #2528. These look important to me and should be prioritized as they relate to the usability of our APIs.

@ray6080
Copy link
Contributor

ray6080 commented Jan 9, 2024

Just to document our discussion here.
The problem is because we didn't propagate query result to transaction related APIs. For example, in the following API, we discarded the return result from query, thus beginReadOnlyTransaction is not able to report errors to users.

void Connection::beginReadOnlyTransaction() {
    query("BEGIN TRANSACTION READ ONLY");
}

The solution is that we should remove following interfaces, beginWriteTransaction , beginReadOnlyTransaction, commit, rollback from cpp APIs, and let users go through equivalent Cypher statements directly.

@semihsalihoglu-uw semihsalihoglu-uw added the usability Issues related to better usability experience, including bad error messages label Jan 10, 2024
@ray6080 ray6080 changed the title Transaction bugs/issues Transaction API issues Feb 12, 2024
@ray6080 ray6080 linked a pull request Feb 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority transactions Transaction management related issues usability Issues related to better usability experience, including bad error messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants