New $clusterTime is too far from this node's wall clock time

Hi,

I’ve manually set my mac date to 2036, and now when getting back to 2022 I am getting the following error in mongodb:
New $clusterTime, 2112867846, is too far from this node’s wall clock time, 1671039831.

I tried restarting the server but nothing changes. What can I do to solve this?

Kind regards

Hi @Pablo_Caselas_Pedrei

To determine the order of operation in a distributed system, MongoDB uses a Lamport clock, with a defined maximum tolerance of forward/backward movement of 1 year (as per MongoDB 6.0.3, see mongo/vector_clock.idl at r6.0.3 · mongodb/mongo · GitHub). Lamport clocks have a property of always-increasing timestamp. Realistically, any part of your cluster should not have a time difference of more than 1 year. If you do, then this error will appear.

If you’re faced with this situation, you have two possibilities:

  1. Set your client’s time to match the cluster’s time. This may or may not be a realistic solution, since all your operations will be logged as happening way forward in the future.
  2. Dump & restore the whole database, and fix the server’s time to the correct time.

I’m guessing that you’re testing failure modes, but since most Linux distros have ntp or similar service by default, your clock should not differ by more than 1 year.

Best regards,
Kevin

It was just my local environment. I restored a backup.

Thanks for the clarification!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.