2018-04-20 22:52:39 +02:00
|
|
|
/**
|
|
|
|
* Test that attempting to call getParameter on the featureCompatibilityVersion before the fCV is
|
|
|
|
* initialized does not crash the server (see SERVER-34600).
|
2019-12-10 21:07:44 +01:00
|
|
|
*
|
|
|
|
* This tests behavior dependent on a specific FCV.
|
|
|
|
* @tags: [multiversion_incompatible]
|
2018-04-20 22:52:39 +02:00
|
|
|
*/
|
|
|
|
(function() {
|
2019-07-27 00:20:35 +02:00
|
|
|
'use strict';
|
2018-04-20 22:52:39 +02:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
let rst = new ReplSetTest({nodes: 2});
|
|
|
|
rst.startSet();
|
|
|
|
let node = rst.nodes[0];
|
2018-04-20 22:52:39 +02:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
// The featureCompatibilityVersion parameter is initialized during rst.initiate(), so calling
|
|
|
|
// getParameter on the fCV before then will attempt to access an uninitialized fCV.
|
2018-04-20 22:52:39 +02:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
const getParamCmd = {
|
|
|
|
getParameter: 1,
|
|
|
|
featureCompatibilityVersion: 1
|
|
|
|
};
|
|
|
|
assert.commandFailedWithCode(
|
|
|
|
node.getDB('admin').runCommand(getParamCmd),
|
|
|
|
ErrorCodes.UnknownFeatureCompatibilityVersion,
|
|
|
|
'expected ' + tojson(getParamCmd) + ' to fail with code UnknownFeatureCompatibilityVersion');
|
2018-04-20 22:52:39 +02:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
rst.initiate();
|
2018-04-20 22:52:39 +02:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
// After the replica set is initialized, getParameter should successfully return the fCV.
|
2018-04-20 22:52:39 +02:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
const primary = rst.getPrimary();
|
|
|
|
const res = primary.adminCommand(getParamCmd);
|
|
|
|
assert.commandWorked(res);
|
|
|
|
assert.eq(res.featureCompatibilityVersion.version, latestFCV, tojson(res));
|
2018-04-20 22:52:39 +02:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
rst.stopSet();
|
2018-04-20 22:52:39 +02:00
|
|
|
})();
|