diff options
author | Reo Kimura <reo.kimura@mongodb.com> | 2022-10-13 20:52:49 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-27 13:47:40 +0000 |
commit | 314b0476d00aa8a5cbbe3114799c07f5939827a2 (patch) | |
tree | 6591ac67047a24f3d8acc2eb00126978a7953a3d | |
parent | 5b1d0b1cee1e5592d759a12fa00335ededcdf707 (diff) | |
download | mongo-314b0476d00aa8a5cbbe3114799c07f5939827a2.tar.gz |
SERVER-69926 errorcodes.py doesn't detect duplicate errors in MONGO_UNREACHABLE_TASSERT
(cherry picked from commit 0d12c83b9b4c3aca1630fc6c41de2f17e4b09ab8)
10 files changed, 26 insertions, 20 deletions
diff --git a/buildscripts/errorcodes.py b/buildscripts/errorcodes.py index 18fca0b027b..e75c36f36e1 100755 --- a/buildscripts/errorcodes.py +++ b/buildscripts/errorcodes.py @@ -46,6 +46,7 @@ _CODE_PATTERNS = [ r"(?:StatusOK)?" r"(?:WithContext)?" r"\s*\(", + r"MONGO_UNREACHABLE_TASSERT\(", # DBException and AssertionException constructors r"(?:DB|Assertion)Exception\s*[({]", # Calls to all LOGV2* variants diff --git a/buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp b/buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp index 834d2052a98..24b0b42fed3 100644 --- a/buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp +++ b/buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp @@ -27,4 +27,9 @@ LOGV2_ERROR(25, "more words"); LOGV2_ERROR(26, "words", - "comma, more words words words words words words words words words words words words " + "comma, more words words words words words words words words words words words words "); +iassert(27, "words"); +iasserted(28, "words"); +iassertNoTrace(29, "words"); +iassertedNoTrace(30, "words"); +MONGO_UNREACHABLE_TASSERT(31); diff --git a/buildscripts/tests/test_errorcodes.py b/buildscripts/tests/test_errorcodes.py index 2a9c9ce1e3f..17c102454b5 100644 --- a/buildscripts/tests/test_errorcodes.py +++ b/buildscripts/tests/test_errorcodes.py @@ -26,7 +26,7 @@ class TestErrorcodes(unittest.TestCase): captured_error_codes.append(code) errorcodes.parse_source_files(accumulate_files, TESTDATA_DIR + 'regex_matching/') - self.assertEqual(26, len(captured_error_codes)) + self.assertEqual(31, len(captured_error_codes)) def test_dup_checking(self): """Test dup checking.""" diff --git a/jstests/aggregation/sources/multiple_unpack_bucket_error.js b/jstests/aggregation/sources/multiple_unpack_bucket_error.js index 5c835b5e16e..3b5f20bf631 100644 --- a/jstests/aggregation/sources/multiple_unpack_bucket_error.js +++ b/jstests/aggregation/sources/multiple_unpack_bucket_error.js @@ -18,7 +18,7 @@ assert.commandFailedWithCode(db.runCommand({ ], cursor: {} }), - 5348302); + 5348304); // $_unpackBucket is an alias of $_internalUnpackBucket, the same restriction should apply. assert.commandFailedWithCode(db.runCommand({ @@ -29,7 +29,7 @@ assert.commandFailedWithCode(db.runCommand({ ], cursor: {} }), - 5348302); + 5348304); assert.commandFailedWithCode(db.runCommand({ aggregate: coll.getName(), pipeline: [ @@ -38,11 +38,11 @@ assert.commandFailedWithCode(db.runCommand({ ], cursor: {} }), - 5348302); + 5348304); assert.commandFailedWithCode(db.runCommand({ aggregate: coll.getName(), pipeline: [{$_unpackBucket: {timeField: 'time'}}, {$_unpackBucket: {timeField: 'time'}}], cursor: {} }), - 5348302); + 5348304); })(); diff --git a/jstests/aggregation/sources/setWindowFields/derivative.js b/jstests/aggregation/sources/setWindowFields/derivative.js index fcacf07447b..bf0e6f88e5e 100644 --- a/jstests/aggregation/sources/setWindowFields/derivative.js +++ b/jstests/aggregation/sources/setWindowFields/derivative.js @@ -192,9 +192,9 @@ function explainUnit(unit) { return coll.runCommand( {explain: {aggregate: coll.getName(), cursor: {}, pipeline: [derivativeStage(unit)]}}); } -assert.commandFailedWithCode(explainUnit('year'), 5490704); -assert.commandFailedWithCode(explainUnit('quarter'), 5490704); -assert.commandFailedWithCode(explainUnit('month'), 5490704); +assert.commandFailedWithCode(explainUnit('year'), 5490710); +assert.commandFailedWithCode(explainUnit('quarter'), 5490710); +assert.commandFailedWithCode(explainUnit('month'), 5490710); assert.commandWorked(explainUnit('week')); assert.commandWorked(explainUnit('day')); assert.commandWorked(explainUnit('hour')); diff --git a/jstests/aggregation/sources/setWindowFields/integral.js b/jstests/aggregation/sources/setWindowFields/integral.js index a62033e2b4f..bb0e962c504 100644 --- a/jstests/aggregation/sources/setWindowFields/integral.js +++ b/jstests/aggregation/sources/setWindowFields/integral.js @@ -115,9 +115,9 @@ function explainUnit(unit) { } }); } -assert.commandFailedWithCode(explainUnit('year'), 5490704); -assert.commandFailedWithCode(explainUnit('quarter'), 5490704); -assert.commandFailedWithCode(explainUnit('month'), 5490704); +assert.commandFailedWithCode(explainUnit('year'), 5490710); +assert.commandFailedWithCode(explainUnit('quarter'), 5490710); +assert.commandFailedWithCode(explainUnit('month'), 5490710); assert.commandWorked(explainUnit('week')); assert.commandWorked(explainUnit('day')); assert.commandWorked(explainUnit('hour')); diff --git a/src/mongo/db/pipeline/lite_parsed_pipeline.cpp b/src/mongo/db/pipeline/lite_parsed_pipeline.cpp index 6f5c269189a..53578f9bb03 100644 --- a/src/mongo/db/pipeline/lite_parsed_pipeline.cpp +++ b/src/mongo/db/pipeline/lite_parsed_pipeline.cpp @@ -175,7 +175,7 @@ void LiteParsedPipeline::validate(const OperationContext* opCtx, // Validates that the pipeline contains at most one $_internalUnpackBucket or $_unpackBucket // stage. - uassert(5348302, + uassert(5348304, str::stream() << "Encountered pipeline with more than one " << DocumentSourceInternalUnpackBucket::kStageNameInternal << " or " << DocumentSourceInternalUnpackBucket::kStageNameExternal << " stage", diff --git a/src/mongo/db/pipeline/window_function/window_function_expression.h b/src/mongo/db/pipeline/window_function/window_function_expression.h index 6214ec4d338..49f7e8ec542 100644 --- a/src/mongo/db/pipeline/window_function/window_function_expression.h +++ b/src/mongo/db/pipeline/window_function/window_function_expression.h @@ -456,7 +456,7 @@ protected: case TimeUnit::year: case TimeUnit::quarter: case TimeUnit::month: - uasserted(5490704, "unit must be 'week' or smaller"); + uasserted(5490710, "unit must be 'week' or smaller"); // Only these time units are allowed. case TimeUnit::week: case TimeUnit::day: @@ -690,11 +690,11 @@ public: } boost::intrusive_ptr<AccumulatorState> buildAccumulatorOnly() const final { - MONGO_UNREACHABLE_TASSERT(5490701); + MONGO_UNREACHABLE_TASSERT(5490706); } std::unique_ptr<WindowFunctionState> buildRemovable() const final { - MONGO_UNREACHABLE_TASSERT(5490702); + MONGO_UNREACHABLE_TASSERT(5490707); } }; @@ -712,11 +712,11 @@ public: } boost::intrusive_ptr<AccumulatorState> buildAccumulatorOnly() const final { - MONGO_UNREACHABLE_TASSERT(5490701); + MONGO_UNREACHABLE_TASSERT(5490708); } std::unique_ptr<WindowFunctionState> buildRemovable() const final { - MONGO_UNREACHABLE_TASSERT(5490702); + MONGO_UNREACHABLE_TASSERT(5490709); } }; diff --git a/src/mongo/db/query/datetime/date_time_support.cpp b/src/mongo/db/query/datetime/date_time_support.cpp index 9567b12357e..a4de7e53580 100644 --- a/src/mongo/db/query/datetime/date_time_support.cpp +++ b/src/mongo/db/query/datetime/date_time_support.cpp @@ -819,7 +819,7 @@ StringData serializeTimeUnit(TimeUnit unit) { case TimeUnit::millisecond: return "millisecond"_sd; } - MONGO_UNREACHABLE_TASSERT(5339900); + MONGO_UNREACHABLE_TASSERT(5339903); } DayOfWeek parseDayOfWeek(StringData dayOfWeek) { diff --git a/src/mongo/s/commands/cluster_map_reduce_agg.cpp b/src/mongo/s/commands/cluster_map_reduce_agg.cpp index 996f726cd67..2723db163d0 100644 --- a/src/mongo/s/commands/cluster_map_reduce_agg.cpp +++ b/src/mongo/s/commands/cluster_map_reduce_agg.cpp @@ -238,7 +238,7 @@ bool runAggregationMapReduce(OperationContext* opCtx, case cluster_aggregation_planner::AggregationTargeter::TargetingPolicy:: kSpecificShardOnly: { // It should not be possible to pass $_passthroughToShard to a map reduce command. - MONGO_UNREACHABLE_TASSERT(6273803); + MONGO_UNREACHABLE_TASSERT(6273805); } } } catch (DBException& e) { |