@@ -1349,42 +1349,45 @@ Administration
1349
1349
1350
1350
The :dbcommand:`fsync` command forces the :program:`mongod` process
1351
1351
to flush all pending writes to the storage layer. :program:`mongod`
1352
- is always writing data to the storage layer within the
1353
- :setting:`syncdelay` interval, which is 60 seconds by default.
1352
+ is always writing data to the storage layer as applications write
1353
+ more data to the database. MongoDB guarantees that it will write
1354
+ all data to disk within the :setting:`syncdelay` interval, which is
1355
+ 60 seconds by default.
1354
1356
1355
1357
.. code-block:: javascript
1356
1358
1357
1359
{ fsync: 1 }
1358
1360
1359
1361
The :dbcommand:`fsync` operation is synchronous by default, to run
1360
- :dbcommand:`fsync` asynchronously, the command is :
1362
+ :dbcommand:`fsync` asynchronously, use the following form :
1361
1363
1362
1364
.. code-block:: javascript
1363
1365
1364
1366
{ fsync: 1, async: true }
1365
1367
1366
- Database backups can be performed using :dbcommand:`fsync` with the
1367
- ``lock`` operator, know as fsync lock. This will flush all data to
1368
- the data storage layer and block all write operations until the
1369
- database is unlocked. To set fsync lock for a database, use the
1370
- following command:
1368
+ The connection will return immediately. You can check the output of
1369
+ :fun:`db.currentOp()` for the status of the :dbcommand:`fsync`
1370
+ operation.
1371
+
1372
+ The primary use of :dbcommand:`fsync` is to lock the database
1373
+ during backup operations. This will flush all data to the data
1374
+ storage layer and block all write operations until you unlock the
1375
+ database. Consider the following command form:
1371
1376
1372
1377
.. code-block:: javascript
1373
1378
1374
1379
{ fsync: 1, lock: true }
1375
1380
1376
1381
.. note::
1377
1382
1378
- Read operations are allowed on a database that is fsync locked
1379
- until the next write operation, which will cause read operations
1380
- to be blocked. The database will then be locked until it is
1381
- unlocked .
1383
+ You may continue to perform read operations on a database that
1384
+ has a :dbcommand:`fsync` lock. However, following the first
1385
+ write operation all subsequent read operations until wait until
1386
+ you unlock the database .
1382
1387
1383
1388
To check on the current state of the fsync lock, use
1384
- :func:`db.currentOp()`.
1385
-
1386
- To unlock the database, make a request for an unlock using the
1387
- following command:
1389
+ :func:`db.currentOp()`. To unlock the database, make a request for
1390
+ an unlock using the following command:
1388
1391
1389
1392
.. code-block:: javascript
1390
1393
@@ -1394,8 +1397,9 @@ Administration
1394
1397
The :func:`db.fsyncLock()` and :func:`db.fsyncUnlock()`
1395
1398
helpers in the shell.
1396
1399
1397
- In the shell, you may use the following shell helpers to simplify the
1398
- :dbcommand:`fsync` lock and unlock process:
1400
+ In the :program:`mongo` shell, you may use the
1401
+ :func:`db.fsyncLock()` and :func:`db.fsyncUnLock()` wrappers for
1402
+ the :dbcommand:`fsync` lock and unlock process:
1399
1403
1400
1404
.. code-block:: javascript
1401
1405
@@ -1406,18 +1410,15 @@ Administration
1406
1410
1407
1411
:dbcommand:`fsync` lock is only possible on individual shards of
1408
1412
a shard cluster, not on the entire shard cluster. To backup an
1409
- entire shard cluster, please read: :ref:`Shard cluster
1410
- considerations for backups
1411
- <backups-with-sharding-and-replication>`
1413
+ entire shard cluster, please read :ref:`considerations for
1414
+ backing up shard clusters <backups-with-sharding-and-replication>`.
1412
1415
1413
- .. note::
1414
-
1415
- With :term:`journaling <journal>` enabled, there are :ref:`other
1416
- methods<backup-with-journaling>` to create a backup.
1416
+ If your :program:`mongod` has :term:`journaling <journal>`
1417
+ enabled, consider using :ref:`another method
1418
+ <backup-with-journaling>` to back up your database.
1417
1419
1418
1420
.. include:: /includes/note-disable-profiling-fsynclock.rst
1419
1421
1420
-
1421
1422
.. dbcommand:: dropDatabase
1422
1423
1423
1424
The :dbcommand:`dropDatabase` command drops a database, deleting
0 commit comments