codeconsole commented on PR #16214:
URL: https://github.com/apache/grails-core/pull/16214#issuecomment-5707413860

   Thanks @jdaugherty and @matrei. Addressed in the latest push.
   
   **Docs** (jdaugherty; matrei #1)
   - What's New: *Read-Only Transactions Behave the Same on MongoDB as on 
Hibernate*.
   - `upgrading80x.adoc`, *20. Other Default Behavior Changes*: what happens to 
a write queued before a read-only transaction (not persisted by it, not seen by 
later queries in the session because it is left in `COMMIT`, discarded when the 
session closes), plus the migration: `save(flush: true)` or a read-write 
transaction.
   - GORM for MongoDB guide: a *Read-Only Transactions* section under 
Transactions, and a note on the Spring Data interop page that `readOnly` only 
governs GORM's flush, so a `MongoTemplate` write inside a read-only transaction 
still commits. The Transactions page no longer opens with "MongoDB doesn't 
support transactions directly"; it points to Multi-Document Transactions.
   
   **Narrative** (#2)
   - Right, `COMMIT` is not the default. The claim came from the 
`Session.setFlushMode` javadoc ("defaults to FlushModeType.COMMIT"), which 
contradicted `AbstractSession` and `ConnectionSourceSettings`; it now says 
`AUTO`.
   - Since the commit message is the permanent record, I rebased onto current 
`8.0.x` and reworded the first commit. `git range-diff` against the reviewed 
commits shows the first one changed only in its message and the other two 
unchanged. The PR body is corrected as well, including its claim that Neo4j 
goes through the new default; as you found, `Neo4jSession` overrides 
`beginTransaction(TransactionDefinition)` itself.
   - The read-only tests now say the read did not persist the write, and each 
also asserts the write is gone after its session closes, so they show what the 
docs describe.
   
   **Nits**
   - #3: `definition != null && definition.isReadOnly()`.
   - #4: `SessionOnlyTransactionSpec` in `grails-datastore-core` with a mocked 
`Session`: flush on read-write commit, none on read-only commit, `clear()` 
without flush on rollback in both modes, no second flush after completion, and 
the deprecated constructor behaving as read-write.
   
   **#5**: agreed, left as is. The `clear()` on a failed commit is consistent 
with `doRollback` and with Spring's Hibernate manager.
   
   Locally: `check` on `grails-datastore-core`, `grails-data-simple`, 
`grails-data-mongodb-core` and `grails-data-mongodb-spring-data` (909 specs, 0 
failures; checkstyle and codenarc clean), and 
`:grails-data-mongodb-docs:asciidoctor`, with the new `#transactions` and 
`#springDataInterop` links resolving in the rendered guide. I did not build 
`grails-doc`; the What's New and upgrade-guide links use the same 
`xref:upgrading#upgrading80x` and `{mongodb5Guide}` forms as the existing 
entries.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to