Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-78054

Do not update and clear cluster server parameters that are not enabled and guarded by feature flag

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Catalog and Routing
    • ALL
    • Security 2023-06-26, Security 2023-07-10, Security 2023-07-24
    • 2

      As part of PM-412 and more precisely as part of SERVER-77077, QuerySettingsManager was introduced, which was supposed maintain the storage of the querySettings cluster parameter.

      The cluster parameter is introduced as part of the project and is therefore guarded with the feature flag.

      Because of that, the instantiation of QuerySettingsManager was also guarded with the feature flag in mongod and mongos main methods.

      This caused an issue, where jstests/noPassthrough/cluster_server_parameter_refresher.js test was failing. It failed because it was calling a getClusterParameter() method on the manager in order to check if it needed to be cleared, however, since manager was not correctly instantiated (it shouldn’t be instantiated because it is guarded with a feature flag), the SharedMutex acquisition could not be performed, causing a crash.

      varun.ravichandran@mongodb.com had a proposal of wrapping the update and clear server parameter calls with:

      {{if (!sp->isEnabled()) { return; }}}

      However, this causes issue with cleaning up existing server parameters on FCV downgrade (an example test)

      The stacktrace:

       

      (gdb) where
      #0  0x00007f7ad8d3193f in raise () from /lib64/libc.so.6
      #1  0x00007f7ad8d1bc95 in abort () from /lib64/libc.so.6
      #2  0x00007f7adb28dfd7 in mongo::(anonymous namespace)::callAbort () at src/mongo/util/assert_util.cpp:76
      #3  0x00007f7adb28f290 in mongo::invariantFailed (expr=<optimized out>, expr@entry=0x7f7ad13e3e86 "Hit a MONGO_UNREACHABLE!", file=<optimized out>, file@entry=0x7f7ad13e3b48 "src/mongo/db/concurrency/locker_impl.cpp", line=<optimized out>, line@entry=161) at src/mongo/util/assert_util.cpp:143
      #4  0x00007f7ad1406dd6 in mongo::LockerImpl::_shouldDelayUnlock (this=<optimized out>, resId=..., mode=<optimized out>) at src/mongo/db/concurrency/locker_impl.cpp:161
      #5  0x00007f7ad14011f3 in mongo::LockerImpl::unlock (this=0x56158468f900, resId=...) at src/mongo/db/concurrency/locker_impl.cpp:598
      #6  0x00007f7ad13ed9ff in mongo::Lock::ResourceLock::_unlock (this=0x7f7aa21bb860) at src/mongo/db/concurrency/d_concurrency.cpp:72
      #7  mongo::Lock::ResourceLock::_unlock (this=this@entry=0x7f7aa21bb860) at src/mongo/db/concurrency/d_concurrency.cpp:69
      #8  0x00007f7ad606afb8 in mongo::Lock::ResourceLock::~ResourceLock (this=0x7f7aa21bb860, __in_chrg=<optimized out>) at src/mongo/db/concurrency/d_concurrency.h:99
      #9  mongo::Lock::SharedLock::~SharedLock (this=0x7f7aa21bb860, __in_chrg=<optimized out>) at src/mongo/db/concurrency/d_concurrency.h:153
      #10 mongo::query_settings::QuerySettingsManager::getClusterParameterTime (this=0x56157e941a90, opCtx=<optimized out>, tenantId=) at src/mongo/db/query/query_settings_manager.cpp:139
      #11 0x00007f7acf644218 in mongo::cluster_parameters::clearParameter (opCtx=opCtx@entry=0x561584650b40, sp=0x56157e7990f0, tenantId=) at src/mongo/idl/cluster_parameter_synchronization_helpers.cpp:95
      #12 0x00007f7acf644408 in mongo::cluster_parameters::clearAllTenantParameters (opCtx=0x561584650b40, tenantId=) at src/mongo/idl/cluster_parameter_synchronization_helpers.cpp:131
      #13 0x00007f7acfe7be9a in mongo::RecoveryUnit::_executeCommitHandlers (this=this@entry=0x56158468ee00, commitTimestamp=...) at src/mongo/db/storage/recovery_unit.cpp:146
      #14 0x00007f7acfe7c1aa in mongo::RecoveryUnit::commitRegisteredChanges (this=this@entry=0x56158468ee00, commitTimestamp=...) at src/mongo/db/storage/recovery_unit.cpp:102
      #15 0x00007f7aceebbb45 in mongo::WiredTigerRecoveryUnit::_commit (this=0x56158468ee00) at src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp:109
      #16 0x00007f7acfe7bac3 in mongo::RecoveryUnit::commitUnitOfWork (this=0x56158468ee00) at src/mongo/db/storage/recovery_unit.cpp:114
      #17 0x00007f7acfe88e94 in mongo::WriteUnitOfWork::commit (this=this@entry=0x7f7aa21bbd10) at /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.spX/include/c++/11.3.0/bits/unique_ptr.h:173
      #18 0x00007f7ad0fe342a in operator() (resolvedNs=..., db=0x56158479cea0, __closure=<optimized out>) at src/mongo/db/catalog/drop_collection.cpp:412
      #19 std::__invoke_impl<mongo::Status, mongo::(anonymous namespace)::_dropCollection(mongo::OperationContext*, const mongo::NamespaceString&, const boost::optional<mongo::UUID>&, mongo::DropReply*, mongo::DropCollectionSystemCollectionMode, bool, boost::optional<mongo::UUID>)::<lambda()>::<lambda(mongo::Database*, const mongo::NamespaceString&)>&, mongo::Database*, const mongo::NamespaceString&> (__f=...) at /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.spX/include/c++/11.3.0/bits/invoke.h:61
      #20 std::__invoke_r<mongo::Status, mongo::(anonymous namespace)::_dropCollection(mongo::OperationContext*, const mongo::NamespaceString&, const boost::optional<mongo::UUID>&, mongo::DropReply*, mongo::DropCollectionSystemCollectionMode, bool, boost::optional<mongo::UUID>)::<lambda()>::<lambda(mongo::Database*, const mongo::NamespaceString&)>&, mongo::Database*, const mongo::NamespaceString&> (__fn=...) at /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.spX/include/c++/11.3.0/bits/invoke.h:116
      #21 std::_Function_handler<mongo::Status(mongo::Database*, const mongo::NamespaceString&), mongo::(anonymous namespace)::_dropCollection(mongo::OperationContext*, const mongo::NamespaceString&, const boost::optional<mongo::UUID>&, mongo::DropReply*, mongo::DropCollectionSystemCollectionMode, bool, boost::optional<mongo::UUID>)::<lambda()>::<lambda(mongo::Database*, const mongo::NamespaceString&)> >::_M_invoke(const std::_Any_data &, mongo::Database *&&, const mongo::NamespaceString &) (__functor=..., __args#0=<optimized out>, __args#1=...) at /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.spX/include/c++/11.3.0/bits/std_function.h:291 

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            denis.grebennicov@mongodb.com Denis Grebennicov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: