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

--notablescan doesn't report missing index for mapreduce (and to client in all cases)

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.0-rc0
    • Component/s: MapReduce
    • Labels:
      None
    • Environment:

      Setup:

      db.a.save({attr:1})
      

      1) A normal find against a missing index will report which attribute is being queried (at least in server log):

      > db.a.find({attr:1})
      error: { "$err" : "table scans not allowed:tmp.a", "code" : 10111 }
      

      Server log:

      Fri Aug 17 15:44:21 [conn1] assertion 10111 table scans not allowed:tmp.a ns:tmp.a query:{ attr: 1.0 }
      

      2) If the query given to map reduce misses an index the query attribute(s) are not reported on either side:

      > db.a.mapReduce(function(){},function(){},{out:'mr_out',query:{attr:1}})
      Fri Aug 17 15:44:34 uncaught exception: map reduce failed:{
              "errmsg" : "exception: table scans not allowed:tmp.a",
              "code" : 10111,
              "ok" : 0
      }
      

      Server log:

      Fri Aug 17 15:44:34 [conn1] CMD: drop tmp.tmp.mr.a_75_inc
      Fri Aug 17 15:44:34 [conn1] build index tmp.tmp.mr.a_75_inc { 0: 1 }
      Fri Aug 17 15:44:34 [conn1] build index done.  scanned 0 total records. 0 secs
      Fri Aug 17 15:44:34 [conn1] CMD: drop tmp.tmp.mr.a_75
      Fri Aug 17 15:44:34 [conn1] build index tmp.tmp.mr.a_75 { _id: 1 }
      Fri Aug 17 15:44:34 [conn1] build index done.  scanned 0 total records. 0.046 secs
      Fri Aug 17 15:44:34 [conn1] mr failed, removing collection :: caused by :: 10111 table scans not allowed:tmp.a
      Fri Aug 17 15:44:34 [conn1] CMD: drop tmp.tmp.mr.a_75
      Fri Aug 17 15:44:34 [conn1] CMD: drop tmp.tmp.mr.a_75_inc
      

      Issues:
      1) Nowhere does it inform which attributes that are being queried when map reduce fails due to --notablescan, which can be hard to track down in complex, dynamic systems.

      2) The error message returned from the server in BOTH cases doesn't include the query attributes, which would be very helpful when debugging. This I assume will apply for all client drivers (observed in js shell and ruby).

            Assignee:
            Unassigned Unassigned
            Reporter:
            crudson Doug Hudson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: