jdaugherty commented on PR #16631:
URL: https://github.com/apache/grails-core/pull/16631#issuecomment-6460570620
Pushed two more commits on top of 72d9720740: cae80795d1 fixes when captures
open and close and what is recorded, and ecd64813fa lets the simple datastore
capture connection sources added at runtime. The head is now ecd64813fa.
**When a capture opens and closes**
- **A datastore that fails to build (MongoDB, simple datastore):** a
datastore now opens the captures of its connections only once it is fully
built, together with those of its child datastores. One that throws partway
through its constructor no longer leaves the file open and locked, which made
the next datastore in the JVM add to the stale run instead of starting a new
one.
- **Schema drop (Hibernate 5 and 7):** the capture now closes when the
session factory starts to close, so the statements `create-drop` runs to drop
the schema are not recorded. The statements that create it never were.
- **How the observer is installed (Hibernate 5 and 7):** the capture's
observer, and the Hibernate 5 observer that destroys the service registry, are
added to the session factory's builder through a `SessionFactoryBuilderFactory`
that the configuration's class-loader service returns. The configuration's own
`sessionFactoryObserver` is no longer swapped out during a build and put back
afterwards.
- **Connection providers added as services (Hibernate 5 and 7):** a
`ConnectionProvider` that a configuration class registers with `addService`
replaces the one Hibernate would choose, so the capture never saw it. It is now
wrapped right after the service registry is built.
- **Two applications in one JVM:** when a second application in the same JVM
(with its own copy of the capture classes, such as a second web application in
one container) finds the file locked by the first, it now stops with a warning
telling it to set its own `grails.gorm.queryTail.file`. Before, it could keep
writing without holding any lock. File locks belong to the process, so neither
application could keep its own lock, or the other's, once the other closed the
file.
- **Neo4j around an application's driver:** only `grails.gorm.queryTail` is
read, through the new `QueryTailSettings.of(PropertyResolver)`. Before, the
whole `grails.gorm` tree was bound, so a `grails.gorm` setting meant for
another datastore, such as a tenant resolver class it can't load, could fail
the Neo4j datastore.
- **Runtime connection sources (simple datastore):** a connection source
added at runtime, as `addTenantForSchema` adds one, now uses the application's
query-tail settings unless its own configuration sets them. Before, it never
captured.
**What is recorded and shown**
- **Subqueries in a select list:** a select whose column list contains a
subquery, as a formula property adds, is shown in full. Selects of the same
table that read different tables in their subqueries no longer count as one
statement.
- **MongoDB arrays:** an array is recorded as its different elements, each
once, without a trailing `...`. One element and many give the same statement
(`{"$in": [?]}`), and an empty array is `[]`. Plain values (anything other than
a document or an array) are no longer rendered one by one, so a large `$in`
costs a single pass.
- **A `--file` that can't be read:** the command now reports a capture file
that is a directory or can't be read, and exits with 1. Before, it showed an
empty summary or kept waiting forever.
**Tests:** I checked that each new spec fails without its fix. The one for a
directory found while the command is following the file hangs without the fix,
so it has a 30-second timeout. Specs that imitated another JVM writing the file
by holding its lock from the same JVM now start a real second JVM, because a
lock held within the same JVM now means a second application.
The guide is updated to match.
--
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]