[SERVER-38196] Coverity analysis defect 105128: Unchecked return value Created: 17/Nov/18  Updated: 29/Oct/23  Resolved: 07/Dec/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.6.10, 4.0.6, 4.1.7

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Misha Tyulenev
Resolution: Fixed Votes: 0
Labels: coverity, neweng, sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.0, v3.6
Sprint: Sharding 2018-12-17
Participants:

 Description   

Value returned from a function is not checked for errors before being used

Defect 105128 (STATIC_C)
Checker CHECKED_RETURN (subcategory none)
File: /src/mongo/db/s/migration_destination_manager.cpp
Function mongo::MigrationDestinationManager::_migrateDriver(mongo::OperationContext *)
/src/mongo/db/s/migration_destination_manager.cpp, line: 880
Calling "_applyMigrateOp" without checking return value (as is done elsewhere 1 out of 2 times).

                _applyMigrateOp(opCtx, mods, &lastOpApplied);



 Comments   
Comment by Githook User [ 27/Dec/18 ]

Author:

{'username': 'mikety', 'email': 'misha@mongodb.com', 'name': 'Misha Tyulenev'}

Message: SERVER-38196 do not wait for replication of mods if they were not applied

(cherry picked from commit ae54786e2830073387673b4c0ea921559065ed5f)
Branch: v4.0
https://github.com/mongodb/mongo/commit/f1d76bd319b43e2cb3c81383409b33eb0ab11318

Comment by Githook User [ 27/Dec/18 ]

Author:

{'username': 'mikety', 'email': 'misha@mongodb.com', 'name': 'Misha Tyulenev'}

Message: SERVER-38196 Coverity analysis defect 105128: Unchecked return value
Branch: v3.6
https://github.com/mongodb/mongo/commit/dd07fc6a7ab1ccf65198b789db0da0d6d630d907

Comment by Githook User [ 07/Dec/18 ]

Author:

{'name': 'Misha Tyulenev', 'email': 'misha@mongodb.com', 'username': 'mikety'}

Message: SERVER-38196 do not wait for replication of mods if they were not applied
Branch: master
https://github.com/mongodb/mongo/commit/ae54786e2830073387673b4c0ea921559065ed5f

Comment by Kaloian Manassiev [ 03/Dec/18 ]

I don't think we can return because in cases where the batch doesn't result in actual writes, it would skip fetching the next batch of mods from the donor. However I think you can just continue; because _applyMigrateOp would be equivalent to lastOpApplied not changing and that would get continued here anyways.

Overall though, I don't think there is much benefit to that so you could just ignore the result of this function.

Comment by Misha Tyulenev [ 03/Dec/18 ]

kaloian.manassiev should the MigrationDestinationDriver return here if _applyMigrateOp returns false - i.e. nothing is applied?

Generated at Thu Feb 08 04:48:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.