[SERVER-33839] Log a warning if a transaction commits with only a single write operation Created: 12/Mar/18 Updated: 06/Dec/22 Resolved: 16/Mar/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Spencer Brody (Inactive) | Assignee: | Backlog - Replication Team |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Replication
|
||||||||
| Participants: | |||||||||
| Comments |
| Comment by Spencer Brody (Inactive) [ 16/Mar/18 ] |
|
Filed |
| Comment by Bruce Lucas (Inactive) [ 13/Mar/18 ] |
|
This sounds like a good metric to have in serverStatus. We should also have a more general discussion about what other transaction-related metrics we need ( |
| Comment by Asya Kamsky [ 13/Mar/18 ] |
|
There are legitimate cases for single document transactions. Original ask was more akin single write affecting single document (ie an operation that would already be transactional). |
| Comment by Alyson Cabral (Inactive) [ 13/Mar/18 ] |
|
milkie thanks for explaining that! spencer I like that idea even better. Should we update the ticket name and description to match that approach? |
| Comment by Spencer Brody (Inactive) [ 13/Mar/18 ] |
|
Maybe the better thing to do is add a metric to serverStatus reporting how many single-document transactions run. Perhaps we could have a breakdown of size of transactions run: 1 document modified, 2 documents modified, 3-5 documents, 5-10 documents, 10-50 documents, or 50+ documents - something like that? Then atlas/cloud manager could surface a warning if the count of single-document transactions goes up. |
| Comment by Eric Milkie [ 13/Mar/18 ] |
|
Our logging style currently does an fsync for every log message, which means if there are a lot of log messages, it can slow down the operation of mongod, as well as overwhelm the log device with IO requests. |
| Comment by Alyson Cabral (Inactive) [ 13/Mar/18 ] |
|
What's the cost exactly? Are we worried about cluttering up the system log for admins? I'm not super worried about the server needing to surface a prompt to the users as Atlas/the monitoring agent can take on that responsibility if we give them the information to act on. |
| Comment by Eric Milkie [ 13/Mar/18 ] |
|
As Spencer has described the work for this ticket, it won't be to prompt the user; instead, a message will appear in the system log each time such a transaction runs, and it will be random chance whether an administrator notices such messages accumulating in the log (and the work to correlate the message to a particular query might not be that easy either, as we cannot put the query data into the message due to redaction concerns). I just don't feel that the cost of putting such a warning into the system log will be outweighed by the potential benefits. |
| Comment by Alyson Cabral (Inactive) [ 13/Mar/18 ] |
|
I'm for having this warning message as I want transactions to be as easy to correctly use as possible and a major part of that is being opinionated about usage. The warning should be to prompt the user to consider the resource/perf cost on an operation that may not need transactions, particularly for people migrating from other databases. It's a huge risk that people will misuse transactions and we'll be very opinionated in the field. spencer I do have a question here, what does one operation mean in this context (i.e does this imply one document, would multiple operations to the same document be included or excluded)? |
| Comment by Eric Milkie [ 13/Mar/18 ] |
|
This sounds inadvisable. There are valid use cases for single operation transactions. What purpose would the warning serve? |