PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 25th of June, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:00:17] <fxmulder> userFlags is set to 1 on this replica, 0 on the others in this collection
[00:02:14] <fxmulder> this is the first time this is being rebuilt on 3, prior rebuilds had been on 2.4
[00:03:47] <joannac> fxmulder: what version?
[00:04:15] <fxmulder> joannac: they're all running 3.0.4 now
[00:04:18] <joannac> fxmulder: oh, yeah. google for "mongodb powerof2sizes"
[00:05:49] <fxmulder> oh yeah I don't want that, these documents will never change
[01:27:25] <pyCasso> I have a discussion at work regards to using mongodb vs a rest api
[01:28:16] <pyCasso> my understanding of mongo is limited so I need to know what are the gains from using mongodb oppose to an api call the returns json objects?
[01:29:23] <pyCasso> folks at work argue that it runs on a different server environment oppose to our native server environment
[01:30:31] <cheeser> none of that made any sense to me.
[01:31:28] <pyCasso> which part?
[01:33:00] <cheeser> why is it mongo vs rest?
[01:34:05] <pyCasso> at work we currently use a rest Architecture to serve json data
[01:34:44] <pyCasso> our dev team want to use monogodb and my understanding is limited
[01:35:26] <pyCasso> i only know that mongo runs on node server and stores data
[01:35:55] <cheeser> mongo runs on node?
[01:36:02] <pyCasso> our current database uses mysql
[01:36:12] <cheeser> there's a node client for mongo...
[01:37:33] <pyCasso> again..im clueless to mongo so i may be wrong
[01:37:54] <cheeser> node and mongo are completely orthogonal
[01:40:10] <pyCasso> ok goodbye
[01:40:30] <cheeser> all righty then
[01:41:32] <d-snp> lol
[01:50:24] <d-snp> cheeser: you just know that guy represents some fortune 500 company with a need for 50.000 mongodb instances right ;)
[01:51:19] <cheeser> well, i'd be happy to help. :)
[03:29:39] <Pak> Hi channel, I am new to mongodb (and db'sin general) - I have a test project here http://quote.machinu.net
[03:30:01] <Pak> it queries for a random document over around 3million documents
[03:30:06] <Pak> and it's slow
[03:30:22] <Pak> (the latency you see on the webpageis caused by the db)
[03:31:01] <Pak> you can compare it with http://quote.machinu.net/1950 - you can see that this one is noticibly faster (only queries with .find({year: 1950}))
[03:31:16] <Pak> whereas the first one is .find({})
[03:31:26] <Pak> So my question is - what am I doing wrong here?
[03:37:19] <cheeser> "get random document" isn't something that mongodb is optimized for
[03:37:44] <Jonno_FTW> is wired tiger the default engine in mongo 3.0?
[03:38:12] <cheeser> https://jira.mongodb.org/browse/SERVER-533
[03:38:18] <cheeser> it is not but will be in 3.2
[03:38:25] <cheeser> actually already is in 3.1.4
[03:38:38] <Jonno_FTW> thanks
[03:39:25] <Jonno_FTW> so it is default in 3.1.4? or do you have to enable it or something?
[03:39:51] <cheeser> it's the default
[03:45:53] <Jonno_FTW> when will it be in the stable release?
[04:27:40] <Pak> cheeser, thanks, I jsut saw your answer
[04:27:51] <Pak> is there any way to auto increment a document field
[04:28:03] <Pak> (or rather, add a field that auto increments)
[09:10:45] <vassilux> hi, I get troubles with my mongo 2.6.1 on Debian 32bits box
[09:11:56] <vassilux> I tried to repair but get error 12 , cannot allocate memory, any workaround ...
[09:54:31] <jelle> vassilux: upgrade to 64bit?
[09:55:58] <vassilux> I cannot now maybe in the future :-)
[09:58:07] <vassilux> I tried with smallfiles but without success
[09:58:51] <vassilux> and nojournal
[10:05:02] <vassilux> the files have 512M size
[10:05:42] <vassilux> Is it my problem ?
[11:33:46] <talbott> hello Mongoers
[11:34:08] <talbott> we are using MongoEngine with our single instance mongodb
[11:34:25] <talbott> and experience a large number of connection timeouts after very sort periods
[11:34:31] <talbott> anyone know why this might be happening?
[12:08:19] <d-snp> 05:30 <@cheeser> "get random document" isn't something that mongodb is optimized for
[12:08:22] <d-snp> 05:30 <@cheeser> "get random document" isn't something that mongodb is optimized for
[12:08:25] <d-snp> woops
[12:08:30] <d-snp> cheeser: what did you mean by that
[12:08:38] <talbott> i'm guessing its the driver, not the db
[12:09:02] <d-snp> isn't mongodb based on a key value store, so it'd be very fast at getting random documents?
[12:09:31] <d-snp> talbott: what did you mean by after short periods?
[12:10:44] <talbott> so, it's a python-flask app
[12:10:47] <talbott> that uses gunicorn
[12:11:15] <talbott> but then after say, 10 or 15mins
[12:11:27] <talbott> when you hit it, there's a connection timout to the mongo
[12:13:40] <talbott> log has this kind of error
[12:13:43] <talbott> [u'AutoReconnect: [Errno 110] Connection timed out', u' File "flask/app.py", line 1817, in wsgi_app', u' File "flask/app.py", line 1477, in full_dispatch_request', u' File "newrelic/hooks/framework_flask.py", line 98, in _nr_wrapper_Flask_handle_exception_', u' File "flask/app.py", line 1381, in handle_user_exception', u' File "flask/app.py", line 1475, in full_dispatch_request', u' File "flask/app.py", line 1461, in dispatch_request', u
[12:13:43] <talbott> ' File "newrelic/hooks/framework_flask.py", line 40, in _nr_wrapper_handler_', u' File "/location-service/app.py", line 49, in geocode', u' File "interactors/location_interactor.py", line 9, in geocode', u' File "services/location_caching_service.py", line 18, in get_location', u' File "mongoengine/queryset/base.py", line 309, in first', u' File "mongoengine/queryset/base.py", line 160, in __getitem__', u' File "pymongo/cursor.py", line
[12:13:44] <talbott> 595, in __getitem__', u' File "pymongo/cursor.py", line 1076, in next', u' File "pymongo/cursor.py", line 1020, in _refresh', u' File "pymongo/cursor.py", line 933, in __send_message', u' File "pymongo/mongo_client.py", line 1217, in _send_message_with_response']
[12:13:53] <talbott> (whoops sorry was meant to be a snippet) :(
[12:16:19] <cheeser> d-snp: there isn't a native operation that says "give me a random value"
[12:19:54] <talbott> is it normal to have connection timeout issues after just a few minutes?
[12:20:40] <deathanchor> talbott: open cursor to mongodb defaults to 10 minute timeout I believe
[12:23:19] <cheeser> correct
[12:24:19] <talbott> Ah so this isnt a connection timeout
[12:24:22] <talbott> it's a cursor timeout
[12:24:41] <talbott> really weird, because it's only retreving a really small number of docs
[12:24:44] <deathanchor> in know in pymongo you can turn off the timeout, but you should ensure you close/exhaust your cusor.
[12:25:20] <deathanchor> talbott: doesn't matter, if you get a cursor, wait 10 minutes and try to read from it it will be dead.
[12:25:21] <talbott> so what is probably happening, is we are not being explicit about closing the cursor?
[12:25:41] <talbott> ah i see anchor
[12:26:00] <talbott> but if the cursor were explicitly closed
[12:26:04] <talbott> we should be ok?
[12:26:12] <deathanchor> if you turn off the timeout, you need to ensure your program closes/exhausts the cursor before exiting/dying
[12:26:38] <deathanchor> depends what your program does
[12:27:17] <deathanchor> perhaps you are reusing the same cursor? you can call something like cursor.exhaust() in pymongo to exhaust it. or cursor.close() to kill it off.
[12:28:04] <triplefoxxy> Hunting down an issue where all the RAM is allocated and system grinds to a halt. I see WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always' could this be connected in anyway?
[12:28:58] <talbott> thanks guys
[13:12:10] <talbott> more on cursor timeouts
[13:12:53] <talbott> the other strange thing here, is that the collection only has 33 docs in
[13:13:16] <talbott> and, with mongoengine you dont really get low level access to cursor exhaust and cursor close
[13:14:28] <cheeser> 33 docs should come back before you can blink.
[13:14:36] <talbott> they do
[13:14:36] <cheeser> is there a proxy/loadbalancer in the mix?
[13:14:42] <talbott> 90% of the time
[13:14:58] <talbott> then...wait for a while
[13:15:00] <talbott> and refresh it
[13:15:12] <talbott> and there's the connection timeout
[13:33:47] <deathanchor> are you creating a new queryset object everytime?
[13:34:23] <deathanchor> per the docs, the default timeout is enabled (makes sense).
[13:34:39] <deathanchor> http://docs.mongoengine.org/en/latest/apireference.html#mongoengine.queryset.QuerySet.timeout
[13:58:10] <greyTEO> is it possible to the id of the doc an update?
[13:58:21] <greyTEO> given that multiple is set to false
[13:59:22] <cheeser> come again?
[14:01:14] <greyTEO> something similar to how it works for an insert. https://gist.github.com/dmregister/31bdfc3e903bbd7f3cfa
[14:01:37] <StephenLynx> yes, you can find and modify.
[14:02:04] <StephenLynx> some drivers, at leat the node.js one, has specific operations for finding one and finding multiple documents now.
[14:02:11] <StephenLynx> and has deprecated findandmodify.
[14:02:39] <StephenLynx> so you don't need to specify {multiple:Boolean} anymore.
[14:02:44] <StephenLynx> just a side note.
[14:02:57] <greyTEO> will find and modify upsert?
[14:03:01] <StephenLynx> yes.
[14:03:06] <greyTEO> bingo
[14:03:12] <greyTEO> thanks StephenLynx
[14:03:28] <StephenLynx> look at your driver documentation, I know I have used find and modify with upset at least once.
[14:03:33] <StephenLynx> upsert*
[14:04:46] <deathanchor> anyone have code for finding specific ops and killing them in mongodb?
[14:04:57] <greyTEO> it's the java drive. it does have support for upsert
[14:05:18] <cheeser> deathanchor: http://docs.mongodb.org/manual/reference/method/db.killOp/
[14:05:29] <cheeser> and http://docs.mongodb.org/manual/reference/method/db.currentOp/#db.currentOp
[14:05:44] <StephenLynx> from what I heard, the first developed driver was the java one. I wouldn't be surprised if its the most complete out there.
[14:06:35] <cheeser> it was. the c# driver i know is pretty complete and offers some features the java driver doesn't. (though i'm working on one of those gaps)
[14:07:34] <deathanchor> cheeser: yeah, I use those manually, but I was wondering if anyone wrote code for checking currentOp and killing it if it met certain conditions
[14:07:46] <cheeser> ah. dunno.
[14:11:16] <greyTEO> I havent found much the java driver doesnt support.
[14:24:33] <fxmulder> so I had been running cleanupOrphaned on one of my replica sets, the server it was running on crashed and now when I try to run cleanupOrphaned again I'm getting "server is not part of a sharded cluster or the sharding metadata is not yet initialized."
[15:03:14] <hashpuppy> i need to take down one of my mongodb servers for maintenance. i have m1, m2, and arbiter. i'm taking down m1 (master). what's the best way to do this? just stop the instance?
[15:04:34] <cheeser> rs.stepDown()
[15:04:38] <cheeser> db.shutdownServer()
[15:04:56] <cheeser> make sure the secondary is up to date
[15:05:46] <hashpuppy> thanks, cheeser
[15:06:18] <hashpuppy> how do i do that. just look at rs.status()?
[15:07:05] <hashpuppy> rs.printSlaveReplicationInfo()
[15:20:57] <synergy_> Are object ids unique over a whole database, or only in a document's collection?
[15:21:52] <cheeser> well, ObjectId is unique globally. but _id values are only required to be unique per collection
[15:23:34] <fxmulder> so what does "server is not part of a sharded cluster or the sharding metadata is not yet initialized." mean if this replica set has a sharded collection?
[15:24:48] <synergy_> I'm confused. ObjectId is unique globally, but _id values aren't necessarily?
[15:25:18] <cheeser> well, _id can be anything so long as it's unique inside that collection
[15:29:45] <synergy_> But that changes if the _id used is an instance of ObjectId?
[15:30:22] <cheeser> nothing changes
[15:30:42] <cheeser> _id is always unique for a collection
[15:31:04] <cheeser> sometimes those values are also unique globally but that's immaterial for a given collection's IDs.
[15:31:24] <synergy_> But if it is an ObjectId then it is also unique globally?
[15:32:13] <deathanchor> synergy_: if you didn't explicitly set it, then you are safe that it is unique globally
[15:33:10] <synergy_> Ok
[15:34:48] <deathanchor> synergy_: you can see what cheeser is talking about if you did a db.test.insert({ _id : "something" }) twice
[15:35:19] <deathanchor> but if you don't set _id, an insert will generate a unique ObjectId for it
[15:35:37] <synergy_> Alright, thanks
[15:38:09] <fxmulder> so db.runCommand( {"shardingState": 1} ) on this replica set says that it is not a shard member while the other replica set still shows that it is a shard member
[15:38:36] <fxmulder> is it safe to enable sharding on the database again in the replica set that doesn't think it is a shard member?
[15:43:48] <deathanchor> fxmulder: did you start it with shardsvr option?
[15:45:13] <fxmulder> deathanchor: yes, shardsvr = true
[15:45:25] <deathanchor> hmm. strange
[15:49:20] <fxmulder> sh.collection.stats() still shows both replica sets as shard members
[16:35:38] <d-snp> hi, in what circumstance could I get a duplicate key error in an update query?
[16:35:58] <d-snp> I do something like collection.update(key, {.. update..}, { .. upsert etc ..})
[16:39:03] <d-snp> http://pastie.org/10258708 this is what it looks like
[16:47:26] <cheeser> if you have an _id field in your update document
[17:37:19] <leandroa> hi. what happens to existing data on a collection when I create a TTL index? I mean, with documents that match the expiration rule
[17:39:30] <cheeser> they get deleted
[18:34:41] <deathanchor> ttl was intro in which version?
[18:35:33] <cheeser> 2.2 http://docs.mongodb.org/manual/tutorial/expire-data/
[18:36:43] <deathanchor> fancy...
[21:19:25] <akoustik> i'm trying to set up a replica set with members in multiple AWS regions. i'm trying to make sure all our traffic between regions is encrypted. i'm assuming it's necessary and sufficient to enable SSL and make sure each host has the keypair. is that about right?
[21:25:29] <GothAlice> akoustik: Aye, and also really, really keep on top of OpenSSL updates.
[21:25:45] <GothAlice> akoustik: Things like heartbleed and weakdh are reality, these days.
[21:27:00] <GothAlice> akoustik: Within the datacenter I additionally use a private VLAN w/ IPsec. No actual firewall rules needed because literally only hosts on the authorized VLAN can communicate, and mongod only listens to that VLAN.
[21:28:53] <akoustik> GothAlice: cool. curious then, what benefit do you get from doing that in addition to just using restricted VPCs in AWS? just a little more confidence, or is it actually a stronger defense?
[21:29:30] <akoustik> (ie confidence in the case that amazon's security isn't as good as advertised, or something like that?)
[21:29:40] <GothAlice> I'm not technically on AWS, since the last time I was they ate my data despite cross-zone failures being against their SLA.
[21:29:47] <GothAlice> So for me it's VLAN or bust.
[21:30:25] <GothAlice> Notably their reliability. (It took me the 36 hours prior to getting my wisdom teeth extracted to reverse engineer the corrupted on-disk files… thanks EBS.)
[21:30:56] <akoustik> ha. well that sucks.
[21:32:12] <akoustik> interesting. well, technically our data source is salesforce, so if/when AWS crashes/burns we at least don't actually lose data and have to worry about that while switching providers.
[21:32:53] <akoustik> main concern is just doing what we can to make transactions reasonably secure.
[21:35:16] <GothAlice> You say "transactions" in #mongodb, and I take a long quaff of my coffee. Using MongoDB for financial information?
[21:35:27] <GothAlice> Notably… transactions?
[21:36:24] <akoustik> oh geez. hahaa. i mean "transactions" informally.
[21:36:42] <GothAlice> Just wanted to be sure since MongoDB itself doesn't do that. :P
[21:37:25] <akoustik> it doesn't automatically integrate with your mobile credit card reader? wtf? i thought this shit was In The Cloud
[21:45:24] <hahuang65> anyone know what safe: true in mongoid refers to? Is it write concern with majority? all? 1?"
[21:47:05] <akoustik> o
[22:04:01] <hahuang65> rastaman_: hey
[22:04:08] <hahuang65> hey
[22:48:47] <rusty78> Hey guys
[22:50:37] <rusty78> If I have a list of users, and I want to make sure no user can register a capitalization change like uSer1 instead of user1
[22:50:47] <rusty78> Anyone know a way to do this without actually grabbing all the users from my db?
[22:51:06] <GothAlice> Store usernames in their canonical form.
[22:51:40] <GothAlice> rusty78: This is much harder than you might expect. Ref: https://en.wikipedia.org/wiki/Unicode_normalization and http://www.unicode.org/reports/tr15/
[22:51:41] <rusty78> Sorry I am a noob, canoncial?
[22:51:49] <GothAlice> "The one true version of the username."
[22:52:08] <GothAlice> I.e. if you want to be case-insensitive, lowercase usernames anywhere they are entered and store them lower-case.
[22:52:36] <rusty78> Sorry here I worded the question poorly
[22:53:01] <rusty78> I do want to allow users to register names with capitalizations
[22:53:13] <rusty78> I just do not want a user to be able to register the same name with only a capitalization change
[22:53:15] <rusty78> if that makes any sense
[22:53:28] <rusty78> like if someone registers uSER, another person cannot register useR
[22:53:29] <rusty78> or user
[22:53:30] <GothAlice> Yes. That's called "case insensitivity". It is "insensitive" to capitolization.
[22:53:36] <rusty78> oh ok sorry
[22:53:38] <GothAlice> If user1 and uSer1 are the "same", lower-case the input (uSer1 -> user1) and then test.
[22:53:58] <GothAlice> Anywhere a username is entered by a user, lower-case it before doing anything else to it. Problem solved.
[22:54:27] <rusty78> Well what if I want to be able to return it
[22:54:47] <GothAlice> Then you will need to store both, but the mixed-case one is for display purposes only. You would continue to query the lower-case version.
[22:54:49] <rusty78> if someone registers uSER, I want to be able to return uSER as their name - I also want to check if the name is unique
[22:54:53] <rusty78> Ah
[22:55:06] <rusty78> makes sense
[22:55:08] <rusty78> Thank you!
[22:57:05] <GothAlice> rusty78: Also, pleasepleaseplease restrict your usernames to the following regular expression: [a-z_][a-zA-Z0-9-_.]+
[22:57:10] <GothAlice> That eliminates the unicode problem.
[22:57:42] <rusty78> if you don't mind me being annoying, what is the unicode problem?
[22:57:52] <GothAlice> è
[22:57:55] <GothAlice> What letter is that?
[22:58:03] <rusty78> heh ah
[22:58:07] <rusty78> good advice :)
[22:58:32] <GothAlice> Depending on your normalization, that can either be the single letter "e with grave accent", or it can be two: "grave accent" followed by an ASCII "e".
[22:58:46] <GothAlice> They look the same, but compare differently.
[22:58:51] <rusty78> right now I have my validator restricting it to alphanumeric only
[22:59:24] <rusty78> That produces a barrier I guess if you want to have cross-language websites
[22:59:29] <GothAlice> No dots or dashes? ;P
[22:59:36] <rusty78> Well.. I'm lazy
[22:59:43] <rusty78> I should go change it :p
[22:59:52] <GothAlice> ;)
[22:59:57] <GothAlice> The regex I gave is typical.
[23:00:14] <rusty78> Yeah, was the + a mistype?
[23:00:27] <GothAlice> Some others include length restriction. A la: [a-z_][a-zA-Z0-9._-]{2,31}
[23:00:31] <GothAlice> Nope. Minimum of two letters. :P
[23:00:38] <GothAlice> The last one is minimum of three.
[23:00:44] <GothAlice> (Maximum of 32.)
[23:01:17] <rusty78> mhmm
[23:01:40] <GothAlice> http://html5pattern.com/Names for other examples. :)
[23:01:52] <rusty78> Quick question
[23:01:59] <rusty78> Why are you so amazing?
[23:02:01] <rusty78> Thank you lol
[23:37:38] <Kharahki> How would you add default data to a collection when it is created? I'm using mongoose and I have a json file that I want to 'import' into the collection when its first created. Is there a good way of doing this?
[23:47:34] <joannac> Kharahki: mongoimport
[23:48:12] <Kharahki> Awesome ill take a look at it :) thanks!