Skip to content

Commit 59991ba

Browse files
author
Sam Kleinman
committed
edits: additional edits for style and coorectness re: DOCS-256
1 parent e41d778 commit 59991ba

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

source/reference/commands.txt

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,42 +1349,45 @@ Administration
13491349

13501350
The :dbcommand:`fsync` command forces the :program:`mongod` process
13511351
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.
13541356

13551357
.. code-block:: javascript
13561358

13571359
{ fsync: 1 }
13581360

13591361
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:
13611363

13621364
.. code-block:: javascript
13631365

13641366
{ fsync: 1, async: true }
13651367

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:
13711376

13721377
.. code-block:: javascript
13731378

13741379
{ fsync: 1, lock: true }
13751380

13761381
.. note::
13771382

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.
13821387

13831388
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:
13881391

13891392
.. code-block:: javascript
13901393

@@ -1394,8 +1397,9 @@ Administration
13941397
The :func:`db.fsyncLock()` and :func:`db.fsyncUnlock()`
13951398
helpers in the shell.
13961399

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:
13991403

14001404
.. code-block:: javascript
14011405

@@ -1406,18 +1410,15 @@ Administration
14061410

14071411
:dbcommand:`fsync` lock is only possible on individual shards of
14081412
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>`.
14121415

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.
14171419

14181420
.. include:: /includes/note-disable-profiling-fsynclock.rst
14191421

1420-
14211422
.. dbcommand:: dropDatabase
14221423

14231424
The :dbcommand:`dropDatabase` command drops a database, deleting

0 commit comments

Comments
 (0)