[SERVER-37484] Only alter table logging settings on startup and not collection creation Created: 05/Oct/18  Updated: 29/Oct/23  Resolved: 15/Nov/18

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.0.6, 4.1.6

Type: Improvement Priority: Major - P3
Reporter: Daniel Gottlieb (Inactive) Assignee: Daniel Gottlieb (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
depends on SERVER-37483 Reintroduce live changes to table log... Closed
Duplicate
is duplicated by SERVER-38447 create index blocked by checkpoint m... Closed
Related
is related to WT-4354 Improve fast path WT_SESSION:alter Backlog
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.0
Sprint: Storage NYC 2018-11-19
Participants:
Case:

 Description   

For upgrade and --enableMajorityReads toggling, startup of a 4.1 mongod must accommodate cases where table logging settings are not in the desired state for the current process lifetime.

Currently that modification is done in the WTRecordStore and WTIndex constructors.

The constructor code path is hit in 3 cases:

  1. Startup
  2. Collection and index creation
  3. Rollback via RTT

Because the desired setting cannot change during the lifetime of a process, ideally we'd only perform the operation on startup (creating new tables selects the right one). I don't believe there's a clear way to distinguish between these cases; I believe the real work of this ticket is to find/add one.

Going by alexander.gorrod's last comment, we can first query the metadata and do a (fragile) string search for log=(enabled=<true|false>) and only call alter if the settings need to be changed.



 Comments   
Comment by Githook User [ 15/Jan/19 ]

Author:

{'username': 'dgottlieb', 'email': 'daniel.gottlieb@mongodb.com', 'name': 'Daniel Gottlieb'}

Message: SERVER-37484: Only change table logging settings if they are not in the expected state.

(cherry picked from commit 9f2d9ce70ecf475386ead7374bf749e0f231c294)
Branch: v4.0
https://github.com/mongodb/mongo/commit/89afd655014137b0dbdfc78e7914a802f7924bb6

Comment by Githook User [ 15/Nov/18 ]

Author:

{'name': 'Daniel Gottlieb', 'email': 'daniel.gottlieb@mongodb.com', 'username': 'dgottlieb'}

Message: SERVER-37484: Only change table logging settings if they are not in the expected state.
Branch: master
https://github.com/mongodb/mongo/commit/9f2d9ce70ecf475386ead7374bf749e0f231c294

Comment by Alexander Gorrod [ 08/Oct/18 ]

daniel.gottlieb it is actually different for WiredTiger. Retrieving metadata is a query via a cursor, so doesn't acquire any strong locks. The WT_SESSION::alter method changes the state of a handle - WiredTiger requires exclusive access to make such changes.

We don't have an optimization in place to avoid taking the lock if there is no change, partly because parsing configuration options is moderately expensive/complex in WiredTiger. If MongoDB can do that comparison simply it would likely be a simpler change.

Comment by Daniel Gottlieb (Inactive) [ 05/Oct/18 ]

A quick clarification alexander.gorrod. I made an assumption resulting in how I described this ticket. Specifically, I assumed that having MongoDB query and parse the table logging settings from a metadata:create cursor would still acquire the locks that result in the behavior we're trying to correct. If that's not true, would it be a reasonable alternative for adjusting the table logging settings to simply do a "check and set"?

Comment by Daniel Gottlieb (Inactive) [ 05/Oct/18 ]

Regarding the dependency on SERVER-37843:

Re-introducing the ability to disable majority reads in 4.1 as part of SERVER-37227 did not reintroduce the live changes to table settings (thus the code links in the description explicitly point at 4.0). The dependency is to correct that bug and then this ticket can address optimizing the no-op cases.

Generated at Thu Feb 08 04:46:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.