diff options
author | Amirsaman Memaripour <amirsaman.memaripour@mongodb.com> | 2020-07-01 15:55:55 +0000 |
---|---|---|
committer | Amirsaman Memaripour <amirsaman.memaripour@mongodb.com> | 2020-07-02 17:31:24 +0000 |
commit | 5fc5142d5827c0c2066759f3d228a0db9812ccd1 (patch) | |
tree | 330612212b9c7353de81d489a08032997934e631 | |
parent | 5d7adc4ee20c0fe752d072021efa484b5f86f894 (diff) | |
download | mongo-5fc5142d5827c0c2066759f3d228a0db9812ccd1.tar.gz |
SERVER-49151 Fix linter to prevent malformed LOGV2 and assertion IDs
(cherry picked from commit 813c96fc1e6d6e5ea422356352b671c3af3e403d)
-rwxr-xr-x | buildscripts/errorcodes.py | 22 | ||||
-rw-r--r-- | src/mongo/db/commands/conn_pool_stats.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/get_last_error.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/exec/return_key.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/migration_util.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/unset_sharding_command.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_reset_error_cmd.cpp | 2 |
8 files changed, 27 insertions, 9 deletions
diff --git a/buildscripts/errorcodes.py b/buildscripts/errorcodes.py index cd631fffef4..4e79503f537 100755 --- a/buildscripts/errorcodes.py +++ b/buildscripts/errorcodes.py @@ -26,6 +26,7 @@ except ImportError: ASSERT_NAMES = ["uassert", "massert", "fassert", "fassertFailed"] MINIMUM_CODE = 10000 +MAXIMUM_CODE = 9999999 # JIRA Ticket + XX # pylint: disable=invalid-name codes = [] # type: ignore @@ -126,8 +127,9 @@ def read_error_codes(): errors = [] dups = defaultdict(list) skips = [] + malformed = [] # type: ignore - # define callback + # define validation callbacks def check_dups(assert_loc): """Check for duplicates.""" codes.append(assert_loc) @@ -144,7 +146,18 @@ def read_error_codes(): dups[code].append(assert_loc) errors.append(assert_loc) - parse_source_files(check_dups) + def validate_code(assert_loc): + """Check for malformed codes.""" + code = int(assert_loc.code) + if code > MAXIMUM_CODE: + malformed.append(assert_loc) + errors.append(assert_loc) + + def callback(assert_loc): + validate_code(assert_loc) + check_dups(assert_loc) + + parse_source_files(callback) if "0" in seen: code = "0" @@ -165,6 +178,11 @@ def read_error_codes(): line, col = get_line_and_column_for_position(loc) print(" %s:%d:%d:%s" % (loc.sourceFile, line, col, loc.lines)) + for loc in malformed: + line, col = get_line_and_column_for_position(loc) + print("MALFORMED ID: %s" % loc.code) + print(" %s:%d:%d:%s" % (loc.sourceFile, line, col, loc.lines)) + return (codes, errors) diff --git a/src/mongo/db/commands/conn_pool_stats.cpp b/src/mongo/db/commands/conn_pool_stats.cpp index fc74d2409fa..3d4ef3b28a6 100644 --- a/src/mongo/db/commands/conn_pool_stats.cpp +++ b/src/mongo/db/commands/conn_pool_stats.cpp @@ -151,7 +151,7 @@ public: const mongo::BSONObj& cmdObj, mongo::BSONObjBuilder& result) override { if (_sampler.tick()) { - LOGV2_WARNING(47187007, + LOGV2_WARNING(4718707, "The shardConnPoolStats command is deprecated. Use instead the " "connPoolStats command."); } diff --git a/src/mongo/db/commands/get_last_error.cpp b/src/mongo/db/commands/get_last_error.cpp index 6c44a68e520..4c57f092dad 100644 --- a/src/mongo/db/commands/get_last_error.cpp +++ b/src/mongo/db/commands/get_last_error.cpp @@ -83,7 +83,7 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) { if (_sampler.tick()) { - LOGV2_WARNING(47187009, "The resetError command is deprecated."); + LOGV2_WARNING(4718709, "The resetError command is deprecated."); } LastError::get(opCtx->getClient()).reset(); return true; diff --git a/src/mongo/db/exec/return_key.cpp b/src/mongo/db/exec/return_key.cpp index 9dd71625924..63d8beb2166 100644 --- a/src/mongo/db/exec/return_key.cpp +++ b/src/mongo/db/exec/return_key.cpp @@ -48,7 +48,7 @@ PlanStage::StageState ReturnKeyStage::doWork(WorkingSetID* out) { Status indexKeyStatus = _extractIndexKey(member); if (!indexKeyStatus.isOK()) { - LOGV2_WARNING(4615602, + LOGV2_WARNING(4615614, "Couldn't execute {stage}, status = {indexKeyStatus}", "stage"_attr = kStageName, "indexKeyStatus"_attr = redact(indexKeyStatus)); diff --git a/src/mongo/db/s/migration_util.cpp b/src/mongo/db/s/migration_util.cpp index 58ecc1d6eb3..134856a6c46 100644 --- a/src/mongo/db/s/migration_util.cpp +++ b/src/mongo/db/s/migration_util.cpp @@ -919,7 +919,7 @@ void resumeMigrationCoordinationsOnStepUp(OperationContext* opCtx) { "migrationCoordinatorDocument"_attr = redact(doc.toBSON())); } else { LOGV2( - 46712004, + 4671204, "Even after forced refresh, the filtering metadata has a UUID that " "does not match the collection UUID in the migration coordinator " "document. Deleting the range deletion tasks on the donor and " diff --git a/src/mongo/db/s/unset_sharding_command.cpp b/src/mongo/db/s/unset_sharding_command.cpp index 19391efdfb7..5bd52379e0e 100644 --- a/src/mongo/db/s/unset_sharding_command.cpp +++ b/src/mongo/db/s/unset_sharding_command.cpp @@ -79,7 +79,7 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) override { if (_sampler.tick()) { - LOGV2_WARNING(47187008, "The unsetSharding command is deprecated."); + LOGV2_WARNING(4718708, "The unsetSharding command is deprecated."); } ShardedConnectionInfo::reset(opCtx->getClient()); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 05892938383..3df894b1d79 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -1063,7 +1063,7 @@ void WiredTigerKVEngine::_openWiredTiger(const std::string& path, const std::str LOGV2_FATAL(4671205, "This version of MongoDB is too recent to start up on the existing data files. " "Try MongoDB 4.2 or earlier."); - fassertFailedNoTrace(46712006); + fassertFailedNoTrace(4671206); } // MongoDB 4.4 doing clean shutdown in FCV 4.2 will use compatibility version 3.3. diff --git a/src/mongo/s/commands/cluster_reset_error_cmd.cpp b/src/mongo/s/commands/cluster_reset_error_cmd.cpp index 35452b23d67..8102119ad96 100644 --- a/src/mongo/s/commands/cluster_reset_error_cmd.cpp +++ b/src/mongo/s/commands/cluster_reset_error_cmd.cpp @@ -71,7 +71,7 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) { if (_sampler.tick()) { - LOGV2_WARNING(47187006, "The resetError command is deprecated."); + LOGV2_WARNING(4718706, "The resetError command is deprecated."); } LastError::get(cc()).reset(); |