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

sh.status() returns incomplete result.

    • Type: Icon: Question Question
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.4.14
    • Component/s: Aggregation Framework
    • Labels:
      None

      Sometimes, sh.status() returns incomplete result.

      mongos> sh.status()
      Tue Sep  1 21:34:25 uncaught exception: group command failed: {
          "retval" : [
              {
                  "shard" : "s0",
                  "nChunks" : 7075
              },
              {
                  "shard" : "s1",
                  "nChunks" : 1806
              },
              {
                  "shard" : "s2",
                  "nChunks" : 600
              },
              {
                  "shard" : "s3",
                  "nChunks" : 8024
              },
              {
                  "shard" : "s4",
                  "nChunks" : 8024
              }
          ],
          "count" : 25529,
          "keys" : 5,
          "errmsg" : "exception: JavaScript execution terminated",
          "code" : 16721,
          "ok" : 0
      }
      

      At this time, config server print this message to it's log file.

      Tue Sep  1 20:20:32.837 [conn11373] command config.$cmd command: { group: { cond: { ns: "db1.coll1" }, key: { shard: 1.0 }, initial: { nChunks: 0.0 }, ns: "chunks", $reduce: function ( doc , out ){ out.nChunks++; } } } ntoreturn:1 keyUpdates:0 numYields: 4 locks(micros) r:2255642 reslen:305 1415ms
      Tue Sep  1 20:20:33.082 [conn11373] JavaScript execution terminated
      

      And according to the source code (src/mongo/db/commands/group.cpp), Looks like aggregation function has 100ms timeout. (I am not sure this is exact cause of incomplete result of sh.status())

                  s->setObject( "$initial" , initial , true );
      
                  s->exec( "$reduce = " + reduceCode , "$group reduce setup" , false , true , true , 100 );
                  s->exec( "$arr = [];" , "$group reduce setup 2" , false , true , true , 100 );
                  ScriptingFunction f = s->createFunction(
                                            "function(){ "
                                            "  if ( $arr[n] == null ){ "
                                            "    next = {}; "
                                            "    Object.extend( next , $key ); "
                                            "    Object.extend( next , $initial , true ); "
                                            "    $arr[n] = next; "
                                            "    next = null; "
                                            "  } "
                                            "  $reduce( obj , $arr[n] ); "
                                            "}" );
      

      Is this something to do with SERVER-17012.
      And Can I change sh.status command(aggreation framework) timeout.

      We have 3 collections and two of them have about 25000 chunks each and the other one has a few chunks.

            Assignee:
            Unassigned Unassigned
            Reporter:
            sunguck.lee@gmail.com 아나 하리
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: