-
Notifications
You must be signed in to change notification settings - Fork 709
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
Full connection and transaction control #493
Conversation
Remove Execer... interfaces. More trouble than worth.
Interesting post on building HTTP handlers, which may be of use: https://blog.merovius.de/2017/06/18/how-not-to-use-an-http-router.html |
Is this feature controllable via REST API because I am implementing an EntityManager which will interface RQLite in remote connection mode and I would like to know where can I find the information to include BEGIN and COMMIT via REST. |
This development effort was abandoned, and is not present in the 5.x release series. I hope to plan to return to it sometime in the future. You can send explicit BEGIN and COMMIT commands to rqlite, but it's undefined what will happen if the cluster has a leader election, or fails, while in a transaction. |
I only use one instance in local it will not be in cluster does it work in single mode?
Can you point out in the documentation what are the params for that? Best regards |
Just send a
|
Well, SQLite -- where that error message is coming from -- is telling you otherwise. Clearly you've issued two |
Are you using the |
Can someone update the change so that there is no incongruency in here and in documentation please?
I am now confused! |
Which documentation?
This code is not in rqlite. It was reverted. This PR (#493) was completely backed out, and all activity associated with it is obsolete. |
Is it possible to just separate the BEGIN COMMIT from the query like we receive a transaction ID that I can track inside of my ORM and then when I do a COMMIT I pass the ID of the transaction? I realized that transactions is not practical and make no sense if we are going to open many transactions in parallel by my ORM. It should be not like localhost:4001/db/execute?pretty&transaction but more like localhost:4001/db/transaction?op=BEGIN and it should return something like:
Then we could do something like:
It would end the transaction by a commit with localhost:4001/db/transaction?op=COMMIT&txId=df7g6weuih23893476354. The ORM has specific function to beginTransaction and commitTransaction in ASYNC mode because I am mapping it to RQLite. That's where two steps gets merged into one with the current implementation which make no sense. Remember that I am only on local mode no cluster. Thanx for answering my threads. |
I'm afraid I'm not following you. There is no concept of transaction ID in rqlite. |
Isn't my description clear enough? |
Your description is referencing functionality that does not exist in rqlite. |
Well if there is a REST API the BEGIN; COMMIT, ROLLBACK and such functions should be by design controllable via the REST API by design isn't it? There an architecture and design flaw with the actual state don't you think? |
rqlite is not just a SQLite database. It's a distributed system, and transactions in a distributed system are not simple to implement. To call it a "flaw" is not correct. You might like to read this thread to understand more about the challenges with implementing distributed transactions. Right now rqlite doesn't support the type of transactions available from direct use of SQLite. This doesn't mean that you can't issue To be clear, I would like to add a form of distributed transactions, but it requires a lot of thought and careful programming. The first attempt (as captured in this PR) didn't work as well I had hoped, unfortunately, so I abandoned the work. |
Well an alternative way of successfully achieving this endeavor would be to first split this project in 2 ways.
Right now I don't need the distributed part of RQLite but I end up having to deal with it. Don't you think that this could be a good design & architecture choice? |
I added a FAQ entry about this. Thanks for your suggestion, but it wouldn't be super helpful. If rqlite was a single-node system then it would be much easier to implement full transaction support. It because it's meant to be distributed that I want to solve the distributed case. |
Again, someone could probably solve the single-node case much easier, such that it could work with an ORM. But that would require forking the project, as it's not something I'm interested in solving for rqlite. I want a solution that works for clusters. |
Well what I was expecting to be able to do with RQLite is via my ORM, which will be connected to an p2p protocol, will take care of the distributed part in every node that will received the propagation. Every node will have their single instance of RQLite running in the background and the synchronisation is just done by simple propagation from my ORM. What are the part that we have to remove to make RQLite single node mode? If this is not too complicated I will implement the single node transaction management the way I described. I think that would be a flavor which will be interesting for people who don't want RQLite in distributed mode. Is there any other RDBMS for SQLite that support full transaction management via REST API like RQLite only in single node mode? |
If you don't want any distributed support, you could modify rqlite by removing all references to the Raft subsystem and just writing straight to the SQLite database. Then you'd have what you want. But you probably need to be familiar with Go to do that, to be honest. |
Well I know some basics of Go which is a good start. Could you direct me which parts are irrelevant so that I can remove them all and then start the implementation? |
At this stage I suggest you trace through the code, and study its implementation. The code you would need to modify will mostly be in |
I'd like to help further, but unfortunately don't have the time. :-/ |
Thank you for the routing I will check that out and see if I understand the code. In the mean time is there any other RDBMS like RQLite that has the functionalities I'm looking for maybe I don't need to implement anything. Can you describe a little bit your development environment what are you using to code for this project? |
I moved the thread to #642 Is it possible to also move some of our comments concerning single instance mode there too ? |
Repo created am I on the good path? |
Makes sense to me. |
This change sees the addition of a new endpoint
/db/connections
.A
POST
to this endpoint returns a new location, that is backed by a dedicated connection to the database. On this connection transactions are supported, meaning commands such asBEGIN
andCOMMIT
are supported. These connections can be configured to abort any transaction that has been without activity for a period of time, or close altogether for the same reason.