You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have a cluster with multiple instances of my node js server running the same application. Some are on different machines or even remotely distant to each other.
I read in your documentation that you specify that:
if you're running multiple apps connected to the same db, provide a string value for _collection that's unique to each app. Do this to avoid a situation where one app rolls back the unfinished transaction(s) of another app.
However, this will not work here because one server may crash and no other servers will look into that collection, so some transactions will remain blocked.
So, if i'm using the same collection for all my servers, and a server restart and call rollback, it could be that some unfinished transaction(s) of another servers get deleted.
did I understand correctly?
I could I solve the issue here?
What happens if I transaction get rolled back while it's running on the other server? does it just fail without compromise the database state? That could be acceptable even if suboptimal.
thanks!
The text was updated successfully, but these errors were encountered:
Good question. Yes, the issue with using the same collection is that another server's transactions could get deleted. In your case, you could use a different collection for each fork of the process and listen for an 'error' or 'exit' event on each of those forks. When one of those events occur, you can use the roller to rollback any "failed" transactions
What about having a "Roller" that run continuously on each server and check the transactions last update time.. if it's older than X (an options of the roller) it delete the transactions, otherwise it will try again later.
We could run this every 30 seconds or so (this too should be an options of the roller)
I guess even with X = 1000ms - 2000ms it should be long enough.
This is dangerous to do rollbacks because this library is not acid compliant and isolation property from acid is not followed. Other parallel transactions see all intermediate changes which was done by current transaction even if it was not completed and they may did their changes which are based at this intermediate state. When we do the rollback to the previous state we do not consider this changes and thus may get incorrect data consistency after rollback.
Without acid isolation we have to do a compensating transaction not rollback.
Hi, I have a cluster with multiple instances of my node js server running the same application. Some are on different machines or even remotely distant to each other.
I read in your documentation that you specify that:
However, this will not work here because one server may crash and no other servers will look into that collection, so some transactions will remain blocked.
So, if i'm using the same collection for all my servers, and a server restart and call rollback, it could be that some unfinished transaction(s) of another servers get deleted.
did I understand correctly?
I could I solve the issue here?
What happens if I transaction get rolled back while it's running on the other server? does it just fail without compromise the database state? That could be acceptable even if suboptimal.
thanks!
The text was updated successfully, but these errors were encountered: