[SERVER-20251] sh.status() returns incomplete result. Created: 01/Sep/15  Updated: 08/Feb/23  Resolved: 02/Sep/15

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: 2.4.14
Fix Version/s: None

Type: Question Priority: Minor - P4
Reporter: 아나 하리 Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-13985 printShardingStatus uses group/JS Closed
Participants:

 Description   

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.



 Comments   
Comment by Ramon Fernandez Marina [ 02/Sep/15 ]

Thanks for your report matt.lee, this issue was addressed in SERVER-13985.

Regards,
Ramón.

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