I am really confused by this paragraph when I was reading EF core docs.
In general, when there is a connection failure the current transaction is rolled back. However, if the connection is dropped while the transaction is being committed the resulting state of the transaction is unknown.
By default, the execution strategy will retry the operation as if the transaction was rolled back, but if it’s not the case this will result in an exception if the new database state is incompatible or could lead to data corruption if the operation does not rely on a particular state, for example when inserting a new row with auto-generated key values.
I don’t really understand, how it could be a issue if connection is lost during a commit, if that happens all the changes will be rollbacked on the database server and then by using an Execution Strategy we could retry to commit the transaction. So I am not understanding how database will be in a different state or how could there be duplicates.
I believe that the whole point of transaction is that if some exception occurs during a commit like connection lost, then the database can know exception occurred and then rollback changes.
Maybe, I am missing something here, Can anybody please elaborate in detail what this paragraph really means with a detailed explanation with examples.
Thanks.