[SERVER-6189] Support date operators on dates before 1970 Created: 24/Jun/12  Updated: 16/Nov/21  Resolved: 02/Aug/12

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 2.2.0-rc1

Type: Improvement Priority: Major - P3
Reporter: Aaron Staple Assignee: Mathias Stearn
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Observed behavior: Verify assertion when a date operator is applied to a date before 1970.
Expected behavior: Proper handling of dates before 1970 or else uassert

Test:

c = db.c;
c.drop();
 
c.save( {} );
 
c.aggregate( { $project:{ a:{ $year:[ new Date( 1960, 0, 1 ) ] } } } );

Log:

Sat Jun 23 20:01:10 [conn14]   Assertion failure (long long)millis >= 0 src/mongo/bson/util/misc.h 96
0x104095055 0x10463dbfb 0x103f24419 0x1042034a3 0x1040ffe3e 0x1040dea0e 0x1040dce2a 0x1040ed03e 0x103e2d320 0x104517941 0x1045c4e51 0x10446b87e 0x10446d5eb 0x10446ea40 0x1046606e5 0x1046611bb 0x1043e5382 0x1043ea0b0 0x103d469c7 0x1045d0f0e 
 0   mongod                              0x0000000104095055 _ZN5mongo15printStackTraceERSo + 37
 1   mongod                              0x000000010463dbfb _ZN5mongo10logContextEPKc + 123
 2   mongod                              0x0000000103f24419 _ZN5mongo12verifyFailedEPKcS1_j + 409
 3   mongod                              0x00000001042034a3 _ZNK5mongo6Date_t7toTimeTEv + 67
 4   mongod                              0x00000001040ffe3e _ZN5mongo6Date_t4toTmEP2tm + 28
 5   mongod                              0x00000001040dea0e _ZNK5mongo14ExpressionYear8evaluateERKN5boost13intrusive_ptrINS_8DocumentEEE + 216
 6   mongod                              0x00000001040dce2a _ZN5mongo14ExpressionNary8optimizeEv + 866
 7   mongod                              0x00000001040ed03e _ZN5mongo16ExpressionObject8optimizeEv + 136
 8   mongod                              0x0000000103e2d320 _ZN5mongo21DocumentSourceProject8optimizeEv + 68
 9   mongod                              0x0000000104517941 _ZN5mongo8Pipeline12parseCommandERSsRNS_7BSONObjERKN5boost13intrusive_ptrINS_17ExpressionContextEEE + 4867
 10  mongod                              0x00000001045c4e51 _ZN5mongo15PipelineCommand3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 145
 11  mongod                              0x000000010446b87e _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRNS_14BSONObjBuilderEb + 142
 12  mongod                              0x000000010446d5eb _ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 4587
 13  mongod                              0x000000010446ea40 _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1472
 14  mongod                              0x00000001046606e5 _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 117
 15  mongod                              0x00000001046611bb _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 1595
 16  mongod                              0x00000001043e5382 _ZN5mongoL13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 418
 17  mongod                              0x00000001043ea0b0 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1136
 18  mongod                              0x0000000103d469c7 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 261
 19  mongod                              0x00000001045d0f0e _ZN5mongo3pms9threadRunEPNS_13MessagingPortE + 1630



 Comments   
Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-08-02T16:27:19-07:00', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}

Message: Fix SERVER-6189 test
Branch: master
https://github.com/mongodb/mongo/commit/9052552b34c22d70e41498305909bacbd2bddc64

Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-08-02T16:24:26-07:00', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}

Message: Try to make SERVER-6189 test more reliable
Branch: master
https://github.com/mongodb/mongo/commit/47affd0dd493aa30059b8afb7b2860096689cb87

Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-08-02T10:12:37-07:00', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}

Message: Add exceptions to test for SERVER-6189 when it is expected to fail
Branch: master
https://github.com/mongodb/mongo/commit/f3343c4e1cde8517b63f9e3a0673c7a09ddf232d

Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-07-31T12:56:59-07:00', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}

Message: SERVER-6189 Support Dates before 1970 in aggregation

This required moving away from Date_t as it asserts on dates before 1970
Some tests are disabled due to SERVER-6666 and SERVER-6679
Branch: master
https://github.com/mongodb/mongo/commit/07e2bbe7293ec7fda7858f141da218477c255f1e

Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-07-30T16:46:25-07:00', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}

Message: Use anonymous union in Value

Prep for SERVER-6189
Branch: master
https://github.com/mongodb/mongo/commit/672a6f79be4dceb1ce585e5435f6f811573a3c3d

Comment by Robin Thomas [ 20/Jul/12 ]

Would be nice for this to make 2.2-rc1; I hit this bug with the first .aggregate() test on my collections after installing 2.2-rc0.

Generated at Thu Feb 08 03:10:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.