Fuzzer minimizer fails when creating index

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • ALL
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      BF-42671 shows an instance of the fuzzer minimizer crashing a blockprocessing fuzzer test run when trying to find the minimal set of indexes that reproduce a result set difference.

      The fuzzer minimizer fails with the following error here:

      [js_test:agg_fuzzer-7d537-1775967038671-53] uncaught exception: Error: command failed: {
      [js_test:agg_fuzzer-7d537-1775967038671-53] 	"ok" : 0,
      [js_test:agg_fuzzer-7d537-1775967038671-53] 	"errmsg" : "Error in specification { name: \"tag_1\", collation: {}, key: { meta: 1.0 } } :: caused by :: The field 'collation' cannot be an empty object.",
      [js_test:agg_fuzzer-7d537-1775967038671-53] 	"code" : 2,
      [js_test:agg_fuzzer-7d537-1775967038671-53] 	"codeName" : "BadValue"
      [js_test:agg_fuzzer-7d537-1775967038671-53] } with original command request: {
      [js_test:agg_fuzzer-7d537-1775967038671-53] 	"createIndexes" : "fuzzer_coll",
      [js_test:agg_fuzzer-7d537-1775967038671-53] 	"indexes" : [
      [js_test:agg_fuzzer-7d537-1775967038671-53] 		{
      [js_test:agg_fuzzer-7d537-1775967038671-53] 			"key" : {
      [js_test:agg_fuzzer-7d537-1775967038671-53] 				"tag" : 1
      [js_test:agg_fuzzer-7d537-1775967038671-53] 			},
      [js_test:agg_fuzzer-7d537-1775967038671-53] 			"name" : "tag_1",
      [js_test:agg_fuzzer-7d537-1775967038671-53] 			"collation" : { }
      [js_test:agg_fuzzer-7d537-1775967038671-53] 		}
      [js_test:agg_fuzzer-7d537-1775967038671-53] 	],
      [js_test:agg_fuzzer-7d537-1775967038671-53] 	"lsid" : {
      [js_test:agg_fuzzer-7d537-1775967038671-53] 		"id" : UUID("70774189-0da3-4aa8-b98b-d5ece206321d")
      [js_test:agg_fuzzer-7d537-1775967038671-53] 	}
      

      The problem is that the fuzzer tries an index with a collation attribute that is an empty object, which is not allowed.

      Stack trace for the error:

      [js_test:agg_fuzzer-7d537-1775967038671-53] _getErrorWithCode@src/mongo/shell/utils.js:32:13
      [js_test:agg_fuzzer-7d537-1775967038671-53] doassert@src/mongo/shell/assert.js:47:14
      [js_test:agg_fuzzer-7d537-1775967038671-53] _doassert@src/mongo/shell/assert.js:181:13
      [js_test:agg_fuzzer-7d537-1775967038671-53] _assertCommandWorked@src/mongo/shell/assert.js:1249:22
      [js_test:agg_fuzzer-7d537-1775967038671-53] assert.commandWorked@src/mongo/shell/assert.js:1423:12
      [js_test:agg_fuzzer-7d537-1775967038671-53] createIndex/<@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3652:28
      [js_test:agg_fuzzer-7d537-1775967038671-53] actOnAllCollections/</<@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3518:23
      [js_test:agg_fuzzer-7d537-1775967038671-53] actOnAllCollections/<@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3517:19
      [js_test:agg_fuzzer-7d537-1775967038671-53] actOnAllCollections@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3516:13
      [js_test:agg_fuzzer-7d537-1775967038671-53] createIndex@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3651:14
      [js_test:agg_fuzzer-7d537-1775967038671-53] replaceIndexOptions@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:4339:22
      [js_test:agg_fuzzer-7d537-1775967038671-53] oracle@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:4373:36
      [js_test:agg_fuzzer-7d537-1775967038671-53] subsetOracle@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3913:44
      [js_test:agg_fuzzer-7d537-1775967038671-53] childOracle@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3924:55
      [js_test:agg_fuzzer-7d537-1775967038671-53] subsetOracle@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3913:44
      [js_test:agg_fuzzer-7d537-1775967038671-53] search@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3887:19
      [js_test:agg_fuzzer-7d537-1775967038671-53] divideAndConquer@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3902:12
      [js_test:agg_fuzzer-7d537-1775967038671-53] genericMinimize@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3916:36
      [js_test:agg_fuzzer-7d537-1775967038671-53] genericMinimize@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:3925:27
      [js_test:agg_fuzzer-7d537-1775967038671-53] minimizeObject@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:4029:17
      [js_test:agg_fuzzer-7d537-1775967038671-53] runIndexOptionsMinimization@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:4378:53
      [js_test:agg_fuzzer-7d537-1775967038671-53] runMinimizer@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:7240:24
      [js_test:agg_fuzzer-7d537-1775967038671-53] minimizeAggFuzzerOutputs@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:7284:40
      [js_test:agg_fuzzer-7d537-1775967038671-53] aggMain@jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:10836:56
      [js_test:agg_fuzzer-7d537-1775967038671-53] @jstestfuzz/out/agg_fuzzer-7d537-1775967038671-53.js:10881:1
      

      The problem seems to be in the oracle function:

              const oracle = (candidateIndexOptions) => {
                  if (typeof candidateIndexOptions !== 'object' || Array.isArray(candidateIndexOptions)) {
                      // Minimization went too far
                      return false;
                  }
                  // Temporarily replace the currentIndexOptions with the candidate one.
                  // If issue is no longer reproducible, reverse the modifications.
                  const currentIndex = state.indexes[i];
                  const currentIndexOptions = state.indexOptions[i];
                  state.indexOptions[i] = candidateIndexOptions;
                  try {
                      replaceIndexOptions(currentIndex, candidateIndexOptions);
                  }
                  catch (error) {
                      // Index creation can fail in various ways if the options are malformed,
                      // especially since the partialFilterExpression is an actual expression
                      // so it can error out in all the various ways invalid expressions can error out.
                      // Hence, we do not try to analyze the error code here -- instead
                      // we just assume that this candidateIndexOptions is not suitable.
                      return false;
                  }
                  if (controlErr.isSameError(cmdFnWithArgs())) {
                      return true;
                  }
                  else {
                      state.indexOptions[i] = currentIndexOptions;
                      replaceIndexOptions(currentIndex, currentIndexOptions);
                      return false;
                  }
              };
      

      In the first part, it tries out some modified version of the index via a call to replaceIndexOptions, and catches any exceptions that happen during index creation.
      If no exception happens, the code continues and reaches the else block at the bottom, in which it creates the index with the original options.
      This is where the createIndexes command fails with an exception. Notably, no exceptions are caught for the second invocation of replaceIndexOptions in the oracle function, so any exception there will terminate the test run.
      This is what happened in the failure for BF-42671.

            Assignee:
            Unassigned
            Reporter:
            Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: