[SERVER-84628] Startup warning in mongos for Read/Write Concern Created: 08/Jan/24  Updated: 01/Feb/24  Resolved: 01/Feb/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 7.0.4
Fix Version/s: 8.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Wernfried Domscheit Assignee: Ali Mir
Resolution: Fixed Votes: 0
Labels: startup_warning
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Zip Archive mongod.zip     Text File test.txt    
Issue Links:
Backports
Assigned Teams:
Replication
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.3, v7.0
Sprint: Repl 2024-02-05
Participants:

 Description   

I upgraded my Sharded cluster to MongoDB version 7.0.4. When I open a `mongosh`
 then I get this warning:

 

Using MongoDB:          7.0.4
Using Mongosh:          2.1.1
 
------
   The server generated these startup warnings when booting
   2024-01-08T12:53:48.900+01:00: This node is running as a shard server, but persisted Read/Write Concern (RWC) defaults are present. This node was likely previously in an unsharded replica set or a config server. The RWC defaults on this node will not be used
------

It is running as a config server, not a shard server as pointed out in the warning message.

sharding:
  clusterRole: configsvr

 



 Comments   
Comment by Githook User [ 01/Feb/24 ]

Author:

{'name': 'Ali Mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-84628 Only log startup warning about persisted CWRWC defaults for shard servers (#18421)

GitOrigin-RevId: 58d45fe39687e4b8a82c6b7d6abe1c3da17d1f3c
Branch: master
https://github.com/mongodb/mongo/commit/3949b49f12ca4dbf07c199b54a8f5d0acda63820

Comment by Noopur Gupta [ 11/Jan/24 ]

Thanks wernfried.domscheit@sunrise.net , I understand this warning is misleading here. I am going to pass this ticket to Service Architecture team.

To Service Architecture Team
1.) Do we expect this warning to occur on config server?
2) If yes, although there is no customer impact from this warning on mongodb functionalities, however as pointed in this ticket, the warning could be misleading. Will it make sense to add another check or warning for config server?

 

Comment by Wernfried Domscheit [ 11/Jan/24 ]

Yes, deleting the ReadWriteConcernDefaults (and restart the server) as advised in support article, removes the warning.

However, I am running PSA (Primary-Secondary-Arbiter) shards and setting DefaultRWConcern is recommended according to Performance Issues with PSA replica sets

 

  • If you don't set DefaultRWConcern in a PSA then you may get startupWarning "** WARNING: The default write concern may change when upgrading to 5.0. Use setDefaultRWConcern to set a cluster-wide default write concern that won't change." or even errors see [Add an arbiter to mongodb ReplicaSet failed|http://example.com]
  • If you set DefaultRWConcern in a PSA then you get warning "This node is running as a shard server, but persisted Read/Write Concern (RWC) defaults are present...."

 

I agree, it is just a warning and does not have any impact. But it is a bit misleading, it triggers the feeling,  that you have done something "not optimal". At least in a PSA configuration, it is indeed the recommended setting.

I see this warning as really useless. But as said, it is a minor issue, you hardly connect to a config-server directly.

Kind Regards
Wernfried

 

 

 

 

 

 

Comment by Noopur Gupta [ 10/Jan/24 ]

Hi wernfried.domscheit@sunrise.net for sharing the details. 

This warning looks like a change made as a part of SERVER-46025.
According to support article , this is simply a warning message to indicate that there was previously a cluster wide read-write concern level configured during the shardsvr’s past life as either a config server or unsharded replica set member. As mentioned in the support article attached previously, there is no action required and is not expected to impact mongodb functionalities.

Please let me know if there are probable server issues that you are experiencing apart from this warning.

Comment by Wernfried Domscheit [ 09/Jan/24 ]

Hi

I followed the upgrade instruction and it worked well. I connected directly to the config-server mongod, because I wanted to check whether mongod is properly running after upgrade/restart:

 

$ mongosh "mongodb://admin:password@${HOSTNAME%%.*}:27019/admin?authSource=admin&readPreference=primaryPreferred"
 
Current Mongosh Log ID: 659cf03a022e48aea8e2b6d7
Connecting to:          mongodb://<credentials>@d-mipmdb-cfg-03:27019/admin?authSource=admin&readPreference=primaryPreferred&directConnection=true&appName=mongosh+2.1.1
Using MongoDB:          7.0.4
Using Mongosh:          2.1.1
 
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
 
------
   The server generated these startup warnings when booting
   2024-01-09T07:52:19.700+01:00: This node is running as a shard server, but persisted Read/Write Concern (RWC) defaults are present. This node was likely previously in an unsharded replica set or a config server. The RWC defaults on this node will not be used
------
 
Deprecation warnings:
  - Using mongosh on the current operating system is deprecated, and support may be removed in a future release.
 
See https://www.mongodb.com/docs/mongodb-shell/install/#supported-operating-systems for documentation on supported platforms.
 
admin@admin configRepSet:SECONDARY> db.serverCmdLineOpts().parsed.sharding
{ clusterRole: 'configsvr' }
 
admin@admin configRepSet:SECONDARY> db.hello()
{
  topologyVersion: {
    processId: ObjectId('659ced2265b8917133b505ef'),
    counter: Long('3')
  },
  hosts: [
    'd-mipmdb-cfg-01.swi.srse.net:27019',
    'd-mipmdb-cfg-02.swi.srse.net:27019',
    'd-mipmdb-cfg-03.swi.srse.net:27019'
  ],
  setName: 'configRepSet',
  setVersion: 45,
  isWritablePrimary: false,
  secondary: true,
  primary: 'd-mipmdb-cfg-02.swi.srse.net:27019',
  me: 'd-mipmdb-cfg-03.swi.srse.net:27019',
  lastWrite: {
    opTime: { ts: Timestamp({ t: 1704783938, i: 21219 }), t: Long('89') },
    lastWriteDate: ISODate('2024-01-09T07:05:38.000Z'),
    majorityOpTime: { ts: Timestamp({ t: 1704783938, i: 21219 }), t: Long('89') },
    majorityWriteDate: ISODate('2024-01-09T07:05:38.000Z')
  },
  isImplicitDefaultMajorityWC: true,
  cwwc: { w: 1, wtimeout: 0 },
  configsvr: 2,
  maxBsonObjectSize: 16777216,
  maxMessageSizeBytes: 48000000,
  maxWriteBatchSize: 100000,
  localTime: ISODate('2024-01-09T07:05:38.578Z'),
  logicalSessionTimeoutMinutes: 30,
  connectionId: 309,
  minWireVersion: 0,
  maxWireVersion: 21,
  readOnly: false,
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1704783938, i: 21219 }),
    signature: {
      hash: Binary.createFromBase64('97whWoXW1zAu/poqFJPJGO1nQZk=', 0),
      keyId: Long('7270495895362234757')
    }
  },
  operationTime: Timestamp({ t: 1704783938, i: 21219 })
} 

Log is also found in logfile:

$ /opt/mongod/jq -r 'select(.id == 4615613)' mongod.log
{
  "t": {
    "$date": "2024-01-09T07:52:19.700+01:00"
  },
  "s": "I",
  "c": "SHARDING",
  "id": 4615613,
  "ctx": "initandlisten",
  "msg": "This node is running as a shard server, but persisted Read/Write Concern (RWC) defaults are present. This node was likely previously in an unsharded replica set or a config server. The RWC defaults on this node will not be used",
  "attr": {
    "configSettingsNamespace": "config.settings"
  },
  "tags": [
    "startupWarnings"
  ]
} 

The message is also shown when I connect to the replica set:

mongosh "mongodb://admin:password@d-mipmdb-cfg-01:27019,d-mipmdb-cfg-02:27019,d-mipmdb-cfg-03:27019/admin?authSource=admin&replicaSet=configRepSet&readPreference=primaryPreferred"
 
------
   The server generated these startup warnings when booting
   2024-01-08T13:22:11.117+01:00: This node is running as a shard server, but persisted Read/Write Concern (RWC) defaults are present. This node was likely previously in an unsharded replica set or a config server. The RWC defaults on this node will not be used
------
 

Logfile is attached. When I connect to a shard server or mongos router then this warning message is not shown.

mongod.zip

 

Comment by Noopur Gupta [ 08/Jan/24 ]

Hi wernfried.domscheit@sunrise.net,

It looks like the above warning is coming from server, but I am a bit unclear about the server it is coming from.
The description and warning message says that you are trying to connect to mongos (shard server), however we see that the server is actually a "config server".

In order to understand the problem, can you share more details on cluster:
1. What node are you trying to connect to?
2. Mongodb logs messages with timestamps during the startup

Also, please make sure that you have followed the upgrade instructions in https://www.mongodb.com/docs/manual/release-notes/7.0-upgrade-sharded-cluster/ , to avoid issues related to an upgrade itself.

Generated at Thu Feb 08 06:55:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.