1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/**
* Tests that large clustered keys can be serialized properly.
*
* @tags: [
* requires_persistence,
* requires_replication,
* requires_fcv_53
* ]
*/
// Use hybrid_geo_index.js to exercise RecordId::serializeToken
(function testRecordSerializationForSkippedRecordTracker() {
'use strict';
load('jstests/noPassthrough/libs/hybrid_geo_index.js');
const rsOptions = {
wiredTigerEngineConfigString: 'eviction_dirty_trigger=80' // needed for larger recordIds
};
const createOptions = {clusteredIndex: {key: {'_id': 1}, unique: true}};
const largeKey = '0'.repeat(8 * 1024 * 1024 - 3); // 8 MB keys
const invalidKey = largeKey + '0';
const validKey = largeKey + '1';
HybridGeoIndexTest.run(rsOptions, createOptions, invalidKey, validKey, Operation.REMOVE);
})();
(function testDuplicateKeyErrorsForLargeKeys() {
'use strict';
const rst = new ReplSetTest({name: 'testName', nodes: 1, nodeOptions: {}});
const nodes = rst.startSet();
rst.initiate();
const primary = rst.getPrimary();
const testDB = primary.getDB('test');
const coll = testDB.getCollection('test');
assert.commandWorked(
testDB.createCollection(coll.getName(), {clusteredIndex: {key: {'_id': 1}, unique: true}}));
const largeKey = '0'.repeat(8 * 1024 * 1024 - 2); // 8 MB key
assert.commandWorked(coll.insert({_id: largeKey, b: {}}));
assert.commandFailedWithCode(coll.insert({_id: largeKey, c: {}}), 11000);
rst.stopSet();
})();
|