Skip to content

Commit 5221ab0

Browse files
committed
Fixed information for fsync and also added section to release notes, NODE-131
1 parent 0933b0d commit 5221ab0

File tree

9 files changed

+75
-56
lines changed

9 files changed

+75
-56
lines changed

docs/articles/AnIntroductionTo1_4_and_2_6.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,11 @@ Buffered Max Entries allow for more fine grained control on how many operations
220220
db.close();
221221
});
222222

223-
This example disables the command buffering completely and errors out the moment there is no connection available. The default value (for backward compatibility) is to buffer until memory runs out. Be aware that by setting a very low value you can cause some problems in failover scenarios in Replicasets as it might take a little but of time before f.ex a new Primary is elected and steps up to accept writes. Setting **bufferMaxEntries** to 0 in this case will cause the driver to error out instead of falling over correctly.
223+
This example disables the command buffering completely and errors out the moment there is no connection available. The default value (for backward compatibility) is to buffer until memory runs out. Be aware that by setting a very low value you can cause some problems in failover scenarios in Replicasets as it might take a little but of time before f.ex a new Primary is elected and steps up to accept writes. Setting **bufferMaxEntries** to 0 in this case will cause the driver to error out instead of falling over correctly.
224+
225+
## Fsync and journal Write Concerns note
226+
227+
MongoDB from version 2.6 and higher disallows the combination of **journal** and **fsync**. Combining them will cause an error while on 2.4 **fsync** was ignored when provided with **journal**. The following semantics apply.
228+
229+
* j: If true block until write operations have been committed to the journal. Cannot be used in combination with `fsync`. Prior to MongoDB 2.6 this option was ignored if the server was running without journaling. Starting with MongoDB 2.6 write operations will fail with an exception if this option is used when the server is running without journaling.
230+
* fsync: If true and the server is running without journaling, blocks until the server has synced all data files to disk. If the server is running with journaling, this acts the same as the `j` option, blocking until write operations have been committed to the journal. Cannot be used in combination with `j`.

lib/mongodb/collection.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ function Collection (db, collectionName, pkFactory, options) {
6969
* Options
7070
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
7171
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
72-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
73-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
72+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
73+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
7474
* - **continueOnError/keepGoing** {Boolean, default:false}, keep inserting documents even if one document has an error, *mongodb 1.9.1 >*.
7575
* - **serializeFunctions** {Boolean, default:false}, serialize functions on the document.
7676
* - **forceServerObjectId** {Boolean, default:false}, let server assign ObjectId instead of the driver
@@ -93,8 +93,8 @@ Collection.prototype.insert = function() { return core.insert; }();
9393
* Options
9494
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
9595
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
96-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
97-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
96+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
97+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
9898
* - **single** {Boolean, default:false}, removes the first document found.
9999
*
100100
* Deprecated Options
@@ -129,8 +129,8 @@ Collection.prototype.rename = function() { return commands.rename; }();
129129
* Options
130130
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
131131
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
132-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
133-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
132+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
133+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
134134
*
135135
* Deprecated Options
136136
* - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
@@ -149,8 +149,8 @@ Collection.prototype.save = function() { return core.save; }();
149149
* Options
150150
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
151151
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
152-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
153-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
152+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
153+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
154154
* - **upsert** {Boolean, default:false}, perform an upsert operation.
155155
* - **multi** {Boolean, default:false}, update all documents matching the selector.
156156
* - **serializeFunctions** {Boolean, default:false}, serialize functions on the document.
@@ -216,8 +216,8 @@ Collection.prototype.drop = function drop(callback) {
216216
* Options
217217
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
218218
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
219-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
220-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
219+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
220+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
221221
* - **remove** {Boolean, default:false}, set to true to remove the object before returning.
222222
* - **upsert** {Boolean, default:false}, perform an upsert operation.
223223
* - **new** {Boolean, default:false}, set to true if you want to return the modified object rather than the original. Ignored for remove.
@@ -241,8 +241,8 @@ Collection.prototype.findAndModify = function() { return core.findAndModify; }()
241241
* Options
242242
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
243243
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
244-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
245-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
244+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
245+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
246246
*
247247
* Deprecated Options
248248
* - **safe** {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB.
@@ -352,8 +352,8 @@ Collection.prototype.findOne = function() { return query.findOne; }();
352352
* Options
353353
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
354354
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
355-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
356-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
355+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
356+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
357357
* - **unique** {Boolean, default:false}, creates an unique index.
358358
* - **sparse** {Boolean, default:false}, creates a sparse index.
359359
* - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible.
@@ -381,8 +381,8 @@ Collection.prototype.createIndex = function() { return index.createIndex; }();
381381
* Options
382382
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
383383
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
384-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
385-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
384+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
385+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
386386
* - **unique** {Boolean, default:false}, creates an unique index.
387387
* - **sparse** {Boolean, default:false}, creates a sparse index.
388388
* - **background** {Boolean, default:false}, creates the index in the background, yielding whenever possible.
@@ -621,8 +621,8 @@ Collection.prototype.stats = function() { return commands.stats; }();
621621
* Options
622622
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
623623
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
624-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
625-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
624+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
625+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
626626
*
627627
* @param {Objects} [options] options for the initializeUnorderedBatch
628628
* @param {Function} callback this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. The second argument will be a UnorderedBulkOperation object.
@@ -637,8 +637,8 @@ Collection.prototype.initializeUnorderedBulkOp = function() { return unordered.i
637637
* Options
638638
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
639639
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
640-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
641-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
640+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
641+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
642642
*
643643
* @param {Objects} [options] options for the initializeOrderedBulkOp
644644
* @param {Function} callback this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. The second argument will be a OrderedBulkOperation object.

lib/mongodb/collection/batch/ordered.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ var shared = require('../shared')
1414
* Options
1515
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
1616
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
17-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
18-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
17+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
18+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
1919
*
2020
* @class Represents a OrderedBulkOperation
2121
* @param {Object} collection collection instance.
@@ -476,8 +476,8 @@ function OrderedBulkOperation (collection, options) {
476476
* Options
477477
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
478478
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
479-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
480-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
479+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
480+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
481481
*
482482
* @param {Object} [options] additional options during update.
483483
* @param {Function} callback this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from from the ordered bulk operation.

lib/mongodb/collection/batch/unordered.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ var shared = require('../shared')
1414
* Options
1515
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
1616
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
17-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
18-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
17+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
18+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
1919
*
2020
* @class Represents a UnorderedBulkOperation
2121
* @param {Object} collection collection instance.
@@ -344,8 +344,8 @@ var UnorderedBulkOperation = function(collection, options) {
344344
* Options
345345
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
346346
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
347-
* - **fsync**, (Boolean, default:false) write waits for fsync before returning
348-
* - **journal**, (Boolean, default:false) write waits for journal sync before returning
347+
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
348+
* - **j**, (Boolean, default:false) write waits for journal sync before returning
349349
*
350350
* @param {Object} [options] additional options during update.
351351
* @param {Function} callback this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from from the unordered bulk operation.

0 commit comments

Comments
 (0)