diff options
author | David Storch <david.storch@10gen.com> | 2015-04-08 14:41:05 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-04-09 16:43:49 -0400 |
commit | 374438c9134e6e31322b05c8ab4c5967d97bf3eb (patch) | |
tree | 07e626f2c197b75e2e97c93b7bb16ca8d73116ef /jstests | |
parent | 8f7ad88b463c5dea8bca8d8e0626fa80f35e3a47 (diff) | |
download | mongo-374438c9134e6e31322b05c8ab4c5967d97bf3eb.tar.gz |
SERVER-17718 deprecate showDiskLoc()
The showDiskLoc() shell helper is now an alias for showRecordId(). The server still
accepts $showDiskLoc for OP_QUERY style find operations. For find command, the showDiskLoc
argument has been renamed to showRecordId.
Also renames the $diskLoc field returned in the resulting documents to $recordId. Unlike
$diskLoc, the $recordId field reports a single 64 bit integer rather than separately reporting the
high-order 32 bits and low-order 32 bits, which have MMAPv1-specific meaning of file and offset.
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/concurrency/fsm_workloads/findAndModify_update_grow.js | 2 | ||||
-rw-r--r-- | jstests/core/show_record_id.js (renamed from jstests/core/showdiskloc.js) | 10 | ||||
-rw-r--r-- | jstests/disk/quota2.js | 3 | ||||
-rw-r--r-- | jstests/mmap_v1/use_power_of_2.js | 6 |
4 files changed, 13 insertions, 8 deletions
diff --git a/jstests/concurrency/fsm_workloads/findAndModify_update_grow.js b/jstests/concurrency/fsm_workloads/findAndModify_update_grow.js index c9c70fecc54..bbf17f2154d 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_update_grow.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_update_grow.js @@ -94,7 +94,7 @@ var $config = (function() { // Since the document has at least doubled in size, and the default // allocation strategy of mmapv1 is to use power of two sizes, the // document will have always moved - assertWhenOwnColl.neq(before.$diskLoc, after.$diskLoc, + assertWhenOwnColl.neq(before.$recordId, after.$recordId, 'document should have moved'); } } diff --git a/jstests/core/showdiskloc.js b/jstests/core/show_record_id.js index a5bcd87bbdd..d28cf6560e6 100644 --- a/jstests/core/showdiskloc.js +++ b/jstests/core/show_record_id.js @@ -1,30 +1,34 @@ -// Sanity check for the $showDiskLoc option. +// Sanity check for the showRecordId option. -t = db.jstests_showdiskloc; +var t = db.show_record_id; t.drop(); function checkResults( arr ) { for( i in arr ) { a = arr[ i ]; - assert( a['$diskLoc'] ); + assert( a['$recordId'] ); } } // Check query. t.save( {} ); checkResults( t.find()._addSpecial("$showDiskLoc" , true).toArray() ); +checkResults( t.find().showRecordId().toArray() ); // Check query and get more. t.save( {} ); t.save( {} ); checkResults( t.find().batchSize( 2 )._addSpecial("$showDiskLoc" , true).toArray() ); +checkResults( t.find().batchSize( 2 ).showRecordId().toArray() ); // Check with a covered index. t.ensureIndex( { a:1 } ); checkResults ( t.find( {}, { _id:0, a:1 } ).hint( { a:1 } )._addSpecial("$showDiskLoc" , true).toArray() ); +checkResults( t.find( {}, { _id:0, a:1 } ).hint( { a:1 } ).showRecordId().toArray() ); // Check with an idhack query. t.drop(); t.save({_id: 0, a: 1}); checkResults( t.find( { _id: 0 } )._addSpecial("$showDiskLoc", true).toArray() ); +checkResults( t.find( { _id: 0 } ).showRecordId().toArray() ); diff --git a/jstests/disk/quota2.js b/jstests/disk/quota2.js index 95639d7cc4c..a53e6dec6b8 100644 --- a/jstests/disk/quota2.js +++ b/jstests/disk/quota2.js @@ -26,7 +26,8 @@ for( i = 0; i < n; ++i ) { c = db[ ''+i ]; res = c.insert({ b: big }); if( !res.hasWriteError() ) { - assert.eq( 0, c.find()._addSpecial( "$showDiskLoc", true )[ 0 ].$diskLoc.file ); + var recordId = c.find().showRecord()[0].$recordId; + assert.eq(0, recordId >> 32); } } diff --git a/jstests/mmap_v1/use_power_of_2.js b/jstests/mmap_v1/use_power_of_2.js index 26977034763..7e7d8a466b2 100644 --- a/jstests/mmap_v1/use_power_of_2.js +++ b/jstests/mmap_v1/use_power_of_2.js @@ -18,16 +18,16 @@ function checkStorageSize(expectedSize, sameLoc) { t.insert(doc); assert.eq(t.stats().size, expectedSize, "size should be expected"); - var oldLoc = t.find()._addSpecial("$showDiskLoc" , true).toArray()[0].$diskLoc; + var oldLoc = t.find().showRecordId().toArray()[0].$recordId; // Remvoe smaller doc, insert a bigger one. t.remove(doc); t.insert(bigDoc); - var newLoc = t.find()._addSpecial("$showDiskLoc" , true).toArray()[0].$diskLoc; + var newLoc = t.find().showRecordId().toArray()[0].$recordId; // Check the diskloc of two docs. - assert.eq(oldLoc.file == newLoc.file && oldLoc.offset == newLoc.offset, sameLoc); + assert.eq(friendlyEqual(oldLoc, newLoc), sameLoc); } t.drop(); |