unexpected three space characters in ns field of mongotop (version 3.0.4) outputs

47 views
Skip to first unread message

yongzh...@gmail.com

unread,
Nov 23, 2015, 1:34:10 PM11/23/15
to mongodb-user
Hi there,

I noticed that there was a format change in the latest build. There are three space characters in a row between db name and table's name (See below for details). Can anyone tell me where these space characters come from? Is this a bug of mongotop or the build? Thanks a lot.

Best,
-Yongzhi


.../bin/mongotop -n 1
2015-11-23T10:23:35.894-0800    connected to: 127.0.0.1

                                                      ns    total    read    write    2015-11-23T10:23:36-08:00
                            AnnotationSource.   Oncomine      0ms     0ms      0ms
                          AnnotationSource.   VARIANTKB1      0ms     0ms      0ms
                      AnnotationSource.   hg19_esp6500_1      0ms     0ms      0ms
...

.../bin/mongotop --version
mongotop version: 3.0.4
git version: efe71bf185cdcfe9632f1fc2e42ca4e895f93269

Wan Bachtiar

unread,
Nov 24, 2015, 12:07:51 AM11/24/15
to mongodb-user

Hi Yong Zhi,

With a trivial test I cannot reproduce the same issue with mongotop 3.0.4.

> ./bin/mongotop --version 
mongotop version: 3.0.4
git version: efe71bf185cdcfe9632f1fc2e42ca4e895f93269

The ns field does not contain any spaces between the db name and the collection’s name.

2015-11-24T14:00:55.108+1100    connected to: 127.0.0.1

                       ns    total    read    write    2015-11-24T14:00:56+11:00
AnnotationSource.nospaces      0ms     0ms      0ms                                                         
...

Although, I can create a collection with spaces on the collection’s name which will show up in mongotop. For example:

2015-11-24T14:04:25.445+1100    connected to: 127.0.0.1

                                ns    total    read    write    2015-11-24T14:04:26+11:00
 AnnotationSource.   prefix3spaces      0ms     0ms      0ms                             
         AnnotationSource.nospaces      0ms     0ms      0ms                             
...

You can also output the result in JSON format with --json option, to check whether the shell output was altered in some way. 


To help troubleshoot can you please confirm some further details:

  • db.version() reported in the mongo shell.
  • Your specific Operating System version.

Regards,

Wan.

yongzhi chen

unread,
Nov 24, 2015, 6:43:17 PM11/24/15
to mongod...@googlegroups.com
Hi Wan,

The first several collections in json output have space in their names:

.../bin/mongotop -n 1 --json
{"totals":{"AnnotationSource.    dgv_20130723":{"total":{"time":0,"count":0},"read":{"time":0,"count":0},"write":{"time":0,"count":0}},"AnnotationSource.   Oncomine":{"total":{"time":0,"count":0},"read":{"time":0,"count":0},"write":{"time":0,"count":0}},"AnnotationSource.  
...
"AnnotationSource.GENEPANEL082dd1f4_02ab_4fab_9de0_d5287ba78c36":{"total":{"time":0,"count":0},"read":{"time":0,"count":0},"write":{"time":0,"count":0}},"AnnotationSource.GENEPANEL1":{"total":{"time":0,"count":0},"read":{"time":0,"count":0},"write":{"time":0,"count":0}},"AnnotationSource.GENEPANEL10":{"total":{"time":0,"count":0},"read":{"time":0,"count":0},"write":{"time":0,"count

Version info.:
> db.version()
3.0.4
OS: Ubuntu12.04

I had new observations when I compared the results from mongotop & db.getCollectionNames():
1, There is no space in the collection name in db.getCollectionNames() outputs;
2, Some collection shown in the mongotop doesn't exist in db.getCollectionNames() list. for example, AnnotationSource.   Oncomine.
3, One collection owns multiple rows in mongotop outputs (dgv_20130723 in this case with different spaces)

Again, mongotop's outputs looked pretty suspicious for me. Thanks.

.../bin/mongotop -n 1
                                                      ns    total    read    write    2015-11-24T15:21:06-08:00
                       AnnotationSource.    dgv_20130723      0ms     0ms      0ms

                            AnnotationSource.   Oncomine      0ms     0ms      0ms
...
                            AnnotationSource.   dbsnp_138     0ms     0ms      0ms
                        AnnotationSource.   dgv_20130723      0ms     0ms      0ms
                          AnnotationSource.   drugbank_1      0ms     0ms      0ms

> db.getCollectionNames()
[
        "GENEPANEL082dd1f4_02ab_4fab_9de0_d5287ba78c36",
        "GENEPANEL1",
...
        "dbsnp_138",
        "dgv_20130723",
        "drugbank_1",
...
]


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/YZsPMviglGQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/e480efdc-7530-4d45-9c03-831ee8eff9b2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Wan Bachtiar

unread,
Nov 24, 2015, 11:13:39 PM11/24/15
to mongodb-user

I had new observations when I compared the results from mongotop & db.getCollectionNames():
1, There is no space in the collection name in db.getCollectionNames() outputs;
2, Some collection shown in the mongotop doesn’t exist in db.getCollectionNames() list. for example, AnnotationSource. Oncomine.
3, One collection owns multiple rows in mongotop outputs (dgv_20130723 in this case with different spaces)

Hi Yong Zhi,

Based on your observations, there is a possibility that these collections may have existed at some point, and then later on removed by dropping the database (i.e. AnnotationSource).

mongotop uses MongoDB top admin command to retrieve usage statistics; and currently there is an open ticket in MongoDB JIRA issue tracker for top command (see SERVER-21168), where databases that have been dropped still shows up in the top’s result.

You can search the mongod log file to confirm whether AnnotationSource database was dropped at some point in the past. For example, the log entries would be something like below :

2015-11-25T14:08:45.486+1100 I COMMAND  [conn1] dropDatabase AnnotationSource starting
2015-11-25T14:08:45.511+1100 I COMMAND  [conn1] dropDatabase AnnotationSource finished

If indeed these collections are only residue of the dropped database, you could schedule a restart of the mongod process to clear them up. Alternatively, if the ‘spaces’ does not effect your operations you could leave it until the next scheduled downtime.

Please feel free to watch or up-vote the issue tracker SERVER-21168 for updates.

Regards,

Wan.

yongzhi chen

unread,
Nov 25, 2015, 1:32:03 PM11/25/15
to mongod...@googlegroups.com
Hi Wan,

This explanation makes sense to me.

By the way, how mongotop/top decide the order of the collection in the output? Do they use the collections' creation time stamps? Thanks.

Best,
-Yongzhi

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/YZsPMviglGQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.

Wan Bachtiar

unread,
Nov 25, 2015, 7:49:13 PM11/25/15
to mongodb-user

how mongotop/top decide the order of the collection in the output? Do they use the collections’ creation time stamps?

Hi Yong Zhi,

Based on the mongotop code, the output order will be sorted by namespace and total milliseconds. See sortableTotal struct.

If you are interested to know more about the inner workings of mongotop, you can view the source code on github under mongo-tools/mongotop.

Kind regards,

Wan.

Reply all
Reply to author
Forward
0 new messages