I'm thinking about implementing transactions to my app to help with consistency issues. I'm using MySQL.
I'm wondering what might happen if while inserting several rows as a transaction, the server will also need to insert a single row, that is completely unrelated.
To be more clear, I will present a scenario (hypothetical) of a store:
The application server in running nodejs, and connected to a MySQL server. It then receives a request to add a stock of 50 new computers, and needs to insert the 50 rows representing their SN to a table
stock, plus a row in another table
shipments, all 51 rows must be inserted in an atomic manner (all or none). While this is happening, the same nodejs server receives a request to register a new customer, and is required to add one row to a table
In that scenario, what will happen if the transaction fails and must be rolled-back? Will the row in
customers be ommited as well? Is this scenario even possible? Or maybe it depends on the implementation, and if so, how to implement it so that this scenario is garanteed never to happen?