@@ -707,46 +707,45 @@ Oplog Entry Timestamp Error
707
707
708
708
.. TODO link this topic to assertion 13290 once assertion guide exists.
709
709
710
- If you receive the following error:
710
+ Consider the following error in :program:`mongod` output and logs :
711
711
712
712
.. code-block:: javascript
713
713
714
714
replSet error fatal couldn't query the local local.oplog.rs collection. Terminating mongod after 30 seconds.
715
715
<timestamp> [rsStart] bad replSet oplog entry?
716
716
717
- Then the value for the ``ts`` field in the last oplog entry might be of
718
- the wrong data type. The correct data type is Timestamp.
717
+ The most often cause of this error is wrongly typed value for the
718
+ ``ts`` field in the last :term:`oplog` entry might be of the wrong
719
+ data type. The correct data type is Timestamp.
719
720
720
- You can check the data type by running the following two queries against the oplog. If the
721
- data type is correct, the queries return the same document; if
722
- incorrect, they return different documents.
723
-
724
- First run a query to return the last document in the oplog:
721
+ You can check the data type by running the following two queries
722
+ against the oplog. If the data is properly typed, the queries will
723
+ return the same document, otherwise these queries will return
724
+ different documents. These queries are:
725
725
726
726
.. code-block:: javascript
727
727
728
728
db.oplog.rs.find().sort({$natural:-1}).limit(1)
729
-
730
- Then run a query to return the last document in the oplog where the
731
- ``ts`` value is a Timestamp. Use the :operator:`$type` operator to query
732
- for type ``17``, which is the Timestamp data type.
733
-
734
- .. code-block:: javascript
735
-
736
729
db.oplog.rs.find({ts:{$type:17}}).sort({$natural:-1}).limit(1)
737
730
731
+ The first query returns the last document in the oplog, while the
732
+ second returns the last document in the oplog where the ``ts`` value
733
+ is a Timestamp. The :operator:`$type` operator allows you to select
734
+ for type 17 ``BSON``, which is the Timestamp data type.
735
+
738
736
If the queries don't return the same document, then the last document in
739
737
the oplog has the wrong data type in the ``ts`` field.
740
738
741
739
.. example::
742
740
743
- As an example, if the first query returns this as the last oplog entry:
741
+ If the first query returns this as the last oplog entry:
744
742
745
743
.. code-block:: javascript
746
744
747
745
{ "ts" : {t: 1347982456000, i: 1}, "h" : NumberLong("8191276672478122996"), "op" : "n", "ns" : "", "o" : { "msg" : "Reconfig set", "version" : 4 } }
748
746
749
- And the second query returns this as the last entry where ``ts`` is a Timestamp:
747
+ And the second query returns this as the last entry where ``ts``
748
+ has the ``Timestamp`` type:
750
749
751
750
.. code-block:: javascript
752
751
@@ -755,10 +754,13 @@ the oplog has the wrong data type in the ``ts`` field.
755
754
Then the value for the ``ts`` field in the last oplog entry is of the
756
755
wrong data type.
757
756
758
- To fix the ``ts`` data type, you can run the following update. Note,
759
- however, that this update scans the whole oplog and can take a lot of
760
- time to pull the oplog into memory:
757
+ To set the proper type for this value and resolve this issue,
758
+ use an update operation that resembles the following:
761
759
762
760
.. code-block:: javascript
763
761
764
762
db.oplog.rs.update({ts:{t:1347982456000,i:1}}, {$set:{ts:new Timestamp(1347982456000, 1)}})
763
+
764
+ Modify the timestamp values as needed based on your oplog entry. This
765
+ operation may take some period to complete because the update must
766
+ scan and pull the entire oplog into memory.
0 commit comments