[SERVER-27035] rs.compareOpTimes() throws exception when comparing with empty OpTime Created: 15/Nov/16  Updated: 05/Apr/17  Resolved: 22/Dec/16

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.4.3, 3.5.2

Type: Bug Priority: Major - P3
Reporter: Judah Schvimer Assignee: Jack Mulrow
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-26065 racy test in autodiscover_config_rs_f... Closed
related to SERVER-27189 _getLastOpTime / _getDurableOpTime do... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4
Sprint: Repl 2016-12-12, Repl 2017-01-23
Participants:

 Description   

This is causing a lot of exceptions to be thrown in tests that look like errors but are really expected behavior. If we want an exception to be thrown, an empty optime should be a special case with a different message or at least the error should print the optimes. An example is here:
https://logkeeper.mongodb.org/build/7372a5210d84ad648172a4ad21da6892/test/582a3e90be07c4674504e874#L436

The following throws an exception, when the empty OpTime should probably just be considered earlier.

rs.compareOpTimes({ts: Timestamp(1,2), t:3}, {ts:Timestamp(0,0), t: -1});
2016-11-14T19:07:40.363-0500 E QUERY    [main] Error: cannot compare optimes between different protocol versions :
rs.compareOpTimes@src/mongo/shell/utils.js:1340:1
@(shell):1:1



 Comments   
Comment by Githook User [ 06/Feb/17 ]

Author:

{u'username': u'jsmulrow', u'name': u'Jack Mulrow', u'email': u'jack.mulrow@mongodb.com'}

Message: SERVER-27035 rs.compareOpTimes() throws exception when comparing with empty OpTime

(cherry picked from commit 2f33ffa96f630df133aa9670e9d9810bfbcca714)
Branch: v3.4
https://github.com/mongodb/mongo/commit/cf97a34201b170d803200b84665654911758a517

Comment by Githook User [ 22/Dec/16 ]

Author:

{u'username': u'jsmulrow', u'name': u'Jack Mulrow', u'email': u'jack.mulrow@mongodb.com'}

Message: SERVER-27035 rs.compareOpTimes() throws exception when comparing with empty OpTime
Branch: master
https://github.com/mongodb/mongo/commit/2f33ffa96f630df133aa9670e9d9810bfbcca714

Comment by Judah Schvimer [ 02/Dec/16 ]

For this ticket we want rs.compareOpTimes() to first check if either OpTime is empty, and if so it should throw with a more helpful message:

Cannot do comparison with null OpTime, received: {ts: Timestamp(1,2), t:3} and {ts:Timestamp(0,0), t: -1}

Comment by Eric Milkie [ 28/Nov/16 ]

I think we should just do SERVER-27189 instead.

Comment by Spencer Brody (Inactive) [ 15/Nov/16 ]

This was introduced in https://github.com/mongodb/mongo/commit/a38156adf985f57861f7f00e1dfa24183abcc105

Generated at Thu Feb 08 04:13:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.