jdaugherty commented on PR #16631:
URL: https://github.com/apache/grails-core/pull/16631#issuecomment-6420856186
@jamesfredley, I pushed e4090dfa34 over d0011c6b80, still a single commit on
9.0.x. It replaces how MongoDB commands are recognized.
d0011c6b80 recognized a command by its shape: a name, a namespace without
`(`, and a document opening with `{"`. A collection name can contain almost any
character, and a command with no options left after redaction, such as `find
db.wide collection`, has no document at all. Commands like these were read as
SQL, so for example `find db.book(archive)` with the field names `a" b` and
`a" b` was recorded as one statement.
No pattern can tell such a command from SQL, so the capture no longer
guesses. A statement recorded through `recordRedacted`, which is how the
MongoDB listener records commands, is marked as a document. The record line
carries that in a field before the statement: `document` or `-`. A document is
written exactly as recorded, escaping only tabs, line breaks and backslashes,
and read back as one. The CLI shows a document as recorded, through
`StatementCollapser.statementOf(record)` in both the summary and the stream,
and never normalizes or collapses it as SQL. The shape pattern is gone.
Tests:
- **`QueryTailRecordSpec`:** documents with escaped quotes, parentheses in a
collection name, spaced collection names with no options, and tabs or line
breaks round-trip through the new field. A statement that only looks like a
command is still written as text.
- **`StatementCollapserSpec` and `QueryTailSummarySpec`:** cover the same
shapes, including `insert db.book(archive) {...}`, which SQL collapsing would
cut at the `(`. Each is counted once, as recorded.
- **`QueryTailCommandListenerSpec`:** against MongoDB, runs the field names
in `book` and in a collection named with parentheses, and bare `find`s on two
collections whose names differ only in their spaces. The database tells each
pair apart, and so does the capture.
- With `recordRedacted` not marking documents, the new summary and MongoDB
features fail.
`:grails-datamapping-core:check` passes locally, as do the MongoDB, Neo4j,
H5 and H7 query-tail specs.
--
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]