Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-17415

2d indexes with invalid 'min' and 'max' values prevent upgrade to 3.0

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.0-rc11
    • Component/s: Geo
    • Fully Compatible
    • ALL

      Problem and Background

      As part of SERVER-5800, validation was added for 'min' and 'max' options on 2d indexes. If a 2.6 server contains an index with invalid options, the upgrade to 3.0 will fail (and db.upgradeCheck() will not warn beforehand):

      exception in initAndListen: 72 region for hash must be valid and have positive area, but [-1, -1] was specified, terminating
      

      Likewise, if a 3.0 secondary replicates from a 2.6 primary, the invalid index options will cause the secondary to abort:

      E REPL     [repl writer worker 15] writer worker caught exception:  :: caused by :: 72 region for hash must be valid and have positive area, but [-1, -1] was specified on: { ts: Timestamp 1425066940000|1, h: -6629994109773807599, v: 2, op: "i", ns: "test.system.indexes", o: { ns: "test.geo", key: { loc: "2d" }, name: "loc_2d", min: -1.0, max: -1.0 } }
      I -        [repl writer worker 15] Fatal Assertion 16360
      
      Program received signal SIGTRAP, Trace/breakpoint trap.
      [Switching to Thread 0x7ff214d76700 (LWP 8374)]
      0x00007ff232c7120b in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
      37	../nptl/sysdeps/unix/sysv/linux/pt-raise.c: No such file or directory.
      (gdb) bt
      #0  0x00007ff232c7120b in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
      #1  0x00000000018f8a7e in mongo::breakpoint () at src/mongo/util/debugger.cpp:63
      #2  0x00000000018eeb31 in mongo::fassertFailedNoTrace (msgid=16360) at src/mongo/util/assert_util.cpp:172
      #3  0x000000000169169b in mongo::repl::multiSyncApply (ops=..., st=0x7ff2256878e0) at src/mongo/db/repl/sync_tail.cpp:663
      #4  0x00000000016937aa in std::_Bind<void (*(boost::reference_wrapper<std::vector<mongo::BSONObj, std::allocator<mongo::BSONObj> > const>, mongo::repl::SyncTail*))(std::vector<mongo::BSONObj, std::allocator<mongo::BSONObj> > const&, mongo::repl::SyncTail*)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) (this=0x75199e0, 
          __args=<unknown type in /home/s/code/mongo/mongo/mongod, CU 0x5be32ee, DIE 0x5c2bcae>) at /usr/include/c++/4.8/functional:1296
      #5  0x0000000001693490 in std::_Bind<void (*(boost::reference_wrapper<std::vector<mongo::BSONObj, std::allocator<mongo::BSONObj> > const>, mongo::repl::SyncTail*))(std::vector<mongo::BSONObj, std::allocator<mongo::BSONObj> > const&, mongo::repl::SyncTail*)>::operator()<, void>() (this=0x75199e0) at /usr/include/c++/4.8/functional:1355
      #6  0x0000000001693013 in std::_Function_handler<void (), std::_Bind<void (*(boost::reference_wrapper<std::vector<mongo::BSONObj, std::allocator<mongo::BSONObj> > const>, mongo::repl::SyncTail*))(std::vector<mongo::BSONObj, std::allocator<mongo::BSONObj> > const&, mongo::repl::SyncTail*)> >::_M_invoke(std::_Any_data const&) (__functor=...)
          at /usr/include/c++/4.8/functional:2071
      #7  0x0000000001642948 in std::function<void ()>::operator()() const (this=0x7ff214d75960) at /usr/include/c++/4.8/functional:2464
      #8  0x00000000018f647e in mongo::threadpool::Worker::loop (this=0x3989380, threadName=...) at src/mongo/util/concurrency/thread_pool.cpp:87
      #9  0x00000000018f845b in std::_Mem_fn<void (mongo::threadpool::Worker::*)(std::string const&)>::operator()<std::string&, void> (this=0x3c78738, __object=0x3989380)
          at /usr/include/c++/4.8/functional:601
      #10 0x00000000018f83ab in std::_Bind<std::_Mem_fn<void (mongo::threadpool::Worker::*)(std::string const&)> (mongo::threadpool::Worker*, std::string)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) (this=0x3c78738, __args=<unknown type in /home/s/code/mongo/mongo/mongod, CU 0x7c3b878, DIE 0x7c641df>)
          at /usr/include/c++/4.8/functional:1296
      #11 0x00000000018f82e0 in std::_Bind<std::_Mem_fn<void (mongo::threadpool::Worker::*)(std::string const&)> (mongo::threadpool::Worker*, std::string)>::operator()<, void>() (
          this=0x3c78738) at /usr/include/c++/4.8/functional:1355
      #12 0x00000000018f82b6 in boost::detail::thread_data<std::_Bind<std::_Mem_fn<void (mongo::threadpool::Worker::*)(std::string const&)> (mongo::threadpool::Worker*, std::string)> >::run() (this=0x3c78580) at src/third_party/boost-1.56.0/boost/thread/detail/thread.hpp:115
      #13 0x000000000198e9cb in boost::(anonymous namespace)::thread_proxy (param=0x3c78580) at src/third_party/boost-1.56.0/libs/thread/src/pthread/thread.cpp:173
      #14 0x00007ff232c69182 in start_thread (arg=0x7ff214d76700) at pthread_create.c:312
      #15 0x00007ff231d6a00d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Impact

      2.6 doesn't check whether min is less than max, but the impact of this problem should be very low, since the invalid range of min / max allows no insert to the collection, if min > max, or only one possible geo value to be insert, if min == max. Using invalid min and max should be very rare in reality.

      Workaround

      One can work around this issue by downgrading to 2.6 or dropping the invalid index. Rebuilding the index with a valid value of min / max will solve this problem in both 2.6 and 3.0.

            Assignee:
            siyuan.zhou@mongodb.com Siyuan Zhou
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: