[Disagg PIT Restore] Re-enable code to drop non-approved params in Disagg PIT Restore

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Replication
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I deleted this code because it seems like we don't need it for public preview, and it's complicating matters with resumability. We can re-enable it eventually.

              LOGV2(11615001, "Moving into doctoring metadata phase.");
              magic_restore::dropNonRestoredClusterParameters(opCtx, _storage);
      
              // TODO (SERVER-120308): Wait for a bounded amount of time.
              // Wait again for the checkpoint to include cleaned up metadata.
              lastTs = getMyLastAppliedOpTime().getTimestamp();
              LOGV2(11615002,
                    "Waiting for checkpoint to advance after metadata doctoring",
                    "targetCheckpointTs"_attr = lastTs);
              while (true) {
                  swCheckpointInfo = _logServerManager->getLastCompletedCheckpointInfoWithRetry();
                  if (!swCheckpointInfo.isOK()) {
                      LOGV2_FATAL(12489405,
                                  "Failed to get last completed checkpoint info",
                                  "error"_attr = swCheckpointInfo.getStatus());
                  }
                  checkpointTs = swCheckpointInfo.getValue().stableTimestamp;
                  if (checkpointTs >= lastTs) {
                      break;
                  }
                  LOGV2(11615003,
                        "Waiting for checkpoint to advance after metadata doctoring",
                        "currentCheckpointTs"_attr = checkpointTs,
                        "targetCheckpointTs"_attr = lastTs);
                  sleepFor(Seconds(2));
              }
      

      Corresponding test:

      /**
       * Tests that Disagg PIT restore correctly cleans non-approved parameters from
       * config.clusterParameters.
       */
      
      import SLS from "src/mongo/db/modules/atlas/jstests/disagg_storage/libs/slstest.js";
      import {MagicRestoreTest} from "src/mongo/db/modules/enterprise/jstests/hot_backups/libs/magic_restore_test.js";
      
      // TODO (SERVER-114794): Stop using this after the process shuts down gracefully.
      TestData.cleanUpCoreDumpsFromExpectedCrash = true;
      
      // Create a page server and log servers
      const sls = new SLS.SLSBackupRestoreTest();
      
      const CELL1 = Object.freeze({cell: "cell1", zone: "zone1"});
      const MDB_LOG_ID = 1;
      const MDB_RESTORE_LOG_ID = 2;
      const ENCRYPTION_KEY_FILE_PATH = SLS.createKeyFile();
      
      const primaryPort = allocatePort();
      let replSetConfig = {
          _id: "sourceCluster",
          version: 1,
          term: 1,
          members: [{_id: 0, host: `localhost:${primaryPort}`, priority: 1}],
      };
      
      let disaggConfig = {
          logID: NumberLong(MDB_LOG_ID),
          myZoneName: CELL1.zone,
          zones: [],
          cellMetadataServer: sls.getNodeByName("cms").uri,
          encryptionKeyFilePath: ENCRYPTION_KEY_FILE_PATH,
          replSetConfig: replSetConfig,
      };
      
      jsTestLog("Starting up primary mongod");
      let rst = SLS.startSingleNodeReplSetTest(disaggConfig, {port: primaryPort});
      let primary = rst.getPrimary();
      
      // 'fleDisableSubstringPreviewParameterLimits' isn't approved and should be dropped. 'querySettings' is valid and
      // so should be retained.
      jsTest.log.info("Inserting params 'fleDisableSubstringPreviewParameterLimits' and 'querySettings'");
      let configDB = primary.getDB("config");
      assert.commandWorked(
          configDB.adminCommand({setClusterParameter: {defaultMaxTimeMS: {readOperations: 31}}}),
      );
      const opTime = {
          ts: assert.commandWorked(
              configDB.adminCommand({
                  setClusterParameter: {
                      fleDisableSubstringPreviewParameterLimits: {shouldOverride: true},
                  },
              }),
          ).operationTime,
      };
      
      const checkpoint = sls.waitForCheckpoint(MDB_LOG_ID, opTime, configDB);
      
      const magicRestoreTest = new MagicRestoreTest({rst: rst, pipeDir: MongoRunner.dataDir});
      
      sls.restoreLog(primary.getDB("test"), MDB_LOG_ID, MDB_RESTORE_LOG_ID, checkpoint);
      
      MongoRunner.stopMongod(primary);
      
      jsTest.log.info("Starting a second replica set on restored log.");
      const restoreConfiguration = {
          "replicaSetConfig": magicRestoreTest.getExpectedConfig(),
          "maxCheckpointTs": SLS.lsnToTimestamp(checkpoint.oplogStableTimestampLsn),
          "nodeType": "replicaSet",
      };
      
      disaggConfig = {
          logID: NumberLong(MDB_RESTORE_LOG_ID),
          myZoneName: CELL1.zone,
          zones: [],
          cellMetadataServer: sls.getNodeByName("cms").uri,
          encryptionKeyFilePath: ENCRYPTION_KEY_FILE_PATH,
          replSetConfig: replSetConfig,
      };
      
      magicRestoreTest.writeObjsAndRunMagicRestore(
          restoreConfiguration,
          /* entriesAfterBackup=*/ [],
          SLS.createMongodOptions(disaggConfig, {port: primaryPort}),
          /* expectCleanShutdown=*/ false,
      );
      
      rst = SLS.startSingleNodeReplSetTest(disaggConfig, {port: primaryPort});
      primary = rst.getPrimary();
      
      // We expect only the approved 'querySettings' param to exist and not the 'randomName' param.
      configDB = primary.getDB("config");
      let allSettings = configDB.clusterParameters.find().toArray();
      jsTest.log.info("All settings in config.clusterParameters: " + tojson(allSettings));
      
      assert.eq(allSettings.length, 1);
      assert.eq(allSettings[0]._id, "defaultMaxTimeMS");
      assert.eq(allSettings[0].readOperations, 31);
      
      MongoRunner.stopMongod(primary);
      
      sls.cleanup();
      
      

            Assignee:
            Unassigned
            Reporter:
            Vishnu Kaushik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: