[SERVER-47313] Allow clients to add context to oplog Created: 02/Apr/20  Updated: 07/Aug/23

Status: Backlog
Project: Core Server
Component/s: Write Ops
Affects Version/s: 4.2.5
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Dave Vasilevsky Assignee: Alan Zheng
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: Repl 2020-04-20
Participants:

 Description   

When a document is mutated, it would be very handy to be able to audit what caused the mutation to happen. However, the oplog doesn't currently include much client context.

Ideally, clients could add some context, eg:

db.runCommand({
  insert: mycoll,
  documents: [{_id: "myid"}],
  oplogContext: {"some": "document}
})

And then this context could appear in the oplog:

{
  "ts": Timestamp(1585854690, 1),
  "t": NumberLong(1),
  ...
  "context": {"some": "document}
}



 Comments   
Comment by Dave Vasilevsky [ 28/Jan/21 ]

Here's a patch we've been running for a bit against 3.6.9: https://github.com/vasi/mongo/commit/234089669bb3f779f926549850a8311939a70718 . We also have one against 4.0, it's similar.

Is this something Mongo upstream is interested in?

Comment by Dave Vasilevsky [ 09/Apr/20 ]

We're working on rolling out a patch against 3.6 locally, we'd be happy to share privately for now (and publicly once we do more testing and make sure it's safe).

Comment by Carl Champain (Inactive) [ 03/Apr/20 ]

Hi vasi@stripe.com,

Thank you for the report.
We're assigning this ticket to the appropriate team to be evaluated against our currently planned work. Updates will be posted on this ticket as they happen.

Kind regards,
Carl
 

Generated at Thu Feb 08 05:13:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.