[SERVER-31650] Change streams do not correctly record diagnostics during initial aggregate command Created: 19/Oct/17 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Aggregation Framework, Diagnostics |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Charlie Swanson | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | change-streams-improvements, open_todo_in_code, query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Assigned Teams: |
Query Execution
|
||||
| Operating System: | ALL | ||||
| Participants: | |||||
| Description |
|
When processing a change stream aggregation, the server will acquire locks on the oplog to do its scan. Unfortunately, acquiring locks is also the process we use to record diagnostics like Top and currentOp (see db_raii.h). This means that the initial aggregate will be treated as if it was an aggregate on the 'local.oplog.rs' collection, using the profiling level of the 'local' database, recording a read entry in the 'local.oplog.rs' section of the top output, and using that namespace in the currentOp output and in the slow query logs. We do register the change stream cursor on the user's requested namespace, so all getMore commands will behave correctly when tracking these metrics. |
| Comments |
| Comment by Charlie Swanson [ 20/Oct/17 ] |
|
It's using AutoGetCollectionOrViewForReadCommand, which does the most things automatically. I think the documentation on each is up to date though - you can see which classes do which 'auto' things - https://github.com/mongodb/mongo/blob/r3.6.0-rc0/src/mongo/db/db_raii.h#L253-L255 |
| Comment by Eric Milkie [ 19/Oct/17 ] |
|
Which db_raii object is it using to read? I believe only some of the constructs in that file trigger a new CurOp, correct? I want to confirm that my code changes to lock the oplog earlier for vectored insert won't have the same ill effects as what is described here for agg. |