[SERVER-7439] makeRecord() and makeDeletedRecord() do not use their size/len arguments Created: 21/Oct/12  Updated: 11/Jul/16  Resolved: 23/Oct/12

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: 2.2.0
Fix Version/s: 2.3.1

Type: Bug Priority: Major - P3
Reporter: Tad Marshall Assignee: Tad Marshall
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

The MongoDataFile::makeRecord(DiskLoc dl, int size) method in src/mongo/db/pdfile.h does not use the 'size' argument that it is passed.

MongoDataFile::makeRecord() is identical to MongoDataFile::recordAt(DiskLoc dl) except for the additional, unused, 'size' parameter.

The only caller of MongoDataFile::makeRecord() is DataFileMgr::makeDeletedRecord(const DiskLoc& dl, int len), also in pdfile.h. makeDeletedRecord() ignores its incoming 'len' argument and passes sizeof(DeletedRecord) as the 'size' parameter to makeRecord() where, as noted above, the parameter is ignored.

MongoDataFile::makeRecord() should be removed. DataFileMgr::makeDeletedRecord() should give up its unused 'len' parameter and should call MongoDataFile::recordAt() instead of makeRecord().



 Comments   
Comment by auto [ 23/Oct/12 ]

Author:

{u'date': u'2012-10-22T10:03:17-07:00', u'email': u'tad@10gen.com', u'name': u'Tad Marshall'}

Message: SERVER-7439 remove unused parameter and redundant routine

Remove the unused 'len' parameter from DataFileMgr::makeDeletedRecord(), make
it call MongoDataFile::recordAt() instead of MongoDataFile::makeRecord().
Remove the now-unused MongoDataFile::makeRecord(). Set nextDeleted to Null
in Extent::init() for completeness (it would get set when the deleted record
was added to a deleted list, so this isn't strictly required). Clean up the
code slightly (reinterpret_cast instead of C-style cast).
Branch: master
https://github.com/mongodb/mongo/commit/001e3afa1a06b800d800c4bf70f1e45738a154a5

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