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

Map-Reduce reports incorrect stats in db.currentOp

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: 2.4.9, 2.5.5
    • Fix Version/s: Backlog
    • Component/s: MapReduce
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      >for(i=0;i<16000;i++) {db.test.insert({val:i})}
      >var mapFunction1 = function() {
      			sleep(1);
                             emit(1,this.val);
                         };
       
      >var reduceFunction1 = function(id, val) {
                                return Array.sum(val);
                            };
      >db.test.mapReduce(                      mapFunction1,                      reduceFunction1,                      { out: "map_reduce_example",query:{val:{$gt:1}} }                    ) //see db.currentOp() in another shell while this one is running

      Show
      >for(i=0;i<16000;i++) {db.test.insert({val:i})} >var mapFunction1 = function() { sleep(1); emit(1,this.val); };   >var reduceFunction1 = function(id, val) { return Array.sum(val); }; >db.test.mapReduce( mapFunction1, reduceFunction1, { out: "map_reduce_example",query:{val:{$gt:1}} } ) //see db.currentOp() in another shell while this one is running

      Description

      In db.currentOp() we support status output for MR jobs. However, if query filter is used, we output status incorrectly:

      > db.currentOp()
      {
      	"inprog" : [
      		{
      			"opid" : 16406,
      			"active" : true,
      			"secs_running" : 6,
      			"op" : "query",
      			"ns" : "test.test",
      			"query" : {
      				"mapreduce" : "test",
      				"map" : function () { sleep(1);                        emit(1,this.val);                    },
      				"reduce" : function (id, val) {
                                return Array.sum(val);
                            },
      				"out" : "map_reduce_example",
      				"query" : {
      					"val" : {
      						"$gt" : 1
      					}
      				}
      			},
      			"client" : "127.0.0.1:57129",
      			"desc" : "conn7",
      			"threadId" : "0x106a87000",
      			"connectionId" : 7,
      			"locks" : {
      				"^" : "r",
      				"^test" : "R"
      			},
      			"waitingForLock" : false,
      			"msg" : "m/r: (1/3) emit phase M/R: (1/3) Emit Progress: 5173/1 517300%",
      			"progress" : {
      				"done" : 5173,
      				"total" : 1
      			},
      			"numYields" : 57,
      			"lockStats" : {
      				"timeLockedMicros" : {
      					"r" : NumberLong(13163605),
      					"w" : NumberLong(1055)
      				},
      				"timeAcquiringMicros" : {
      					"r" : NumberLong(6595364),
      					"w" : NumberLong(7)
      				}
      			}
      		}
      	]
      }

      We need to handle filtered jobs correctly and not output misleading percentages in db.currentOp(). (output in logs is fine)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: