PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 24th of May, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:00:11] <iNick> redsand: just mongodump dbname
[00:00:32] <iNick> trying to find a way back out. guess I could recreate the replset info if needed
[00:01:04] <redsand> you can import the conf you backup using the command line
[00:01:11] <redsand> best i got for you, maybe someone else knows more
[00:03:35] <iNick> redsand: understood. so you're not sure where the replset info is physically stored. no problem :) I can recreate the replset, and import the main db
[06:32:52] <TTilus> a db design consideration: say ive got book, which has embedded chapters and i now want to add themes, which would reference book and have many-to-many with pages
[06:34:15] <TTilus> how do i reference an embedded document?
[06:34:33] <TTilus> i don't?
[07:31:38] <[AD]Turbo> hola
[07:32:34] <kali> bonjour
[07:32:59] <groovemonkey> I have a question about deleting a sub-object nested in an array -- could someone help me?
[07:33:02] <groovemonkey> pastebin here: http://pastebin.com/2VE3uLD9
[07:38:41] <resting> how would i find all documents where packets[0] = 0? with data structure packets: { "0" : "0", "1":"0", "2":"0"….}
[07:39:17] <Gargoyle> Do you need the $ when using $pull. Eg, can you use questions.text instead of questions.$.text
[07:51:19] <Nodex> Gargoyle : it depends how you match your doucment
[07:51:23] <Nodex> document *
[07:51:54] <Gargoyle> Nodex: Oh.
[07:52:30] <Nodex> if you match it on _id for example and the array is an object {} rather than array [] then you dont need it else you do
[07:53:18] <Nodex> groovemonkey : this should answer for you http://pastebin.com/3SCbYDrj
[07:53:28] <Nodex> or hint you in the right direction
[07:56:02] <groovemonkey> Nodex: Thanks, trying it now!
[07:56:24] <Gargoyle> Ah, so it would be { $pull: { 'questions': {'text': questionText }}} ?
[07:58:24] <Nodex> yeh
[08:03:10] <groovemonkey> Nodex: you friggin' rock! Thanks so much.
[08:04:37] <Nodex> no problemo
[08:51:18] <remonvv> \o
[08:51:38] <remonvv> Anyone opinions about the ideal amount of (max) connecties from app servers to mongos's?
[08:52:24] <remonvv> We're seeing a rather spectacular degradation in performance when configuring a high (100) number of connection to mongos
[08:55:54] <TTilus> a db design consideration: say ive got book, which has embedded chapters and i now want to add themes, which would reference book and have many-to-many with pages
[08:58:46] <Nodex> is there a question in there somewhere?
[08:59:01] <Nodex> remonvv : is it read degredation or write?
[08:59:55] <TTilus> what possibilities i have to extend what i already have to include themes?
[09:02:09] <TTilus> coming from rdbms world my first reaction would be to extract chapters from book and introduce many-to-many between chapters and themes
[09:02:37] <TTilus> and sorry, i said "pages" earlier when i ment chapters
[09:03:25] <TTilus> but i assume there surely are other options to implement this
[09:05:55] <TTilus> i would never need to look up for themes or chapters, but always find a book and a chapter inside it and then themes of that chapter
[09:06:14] <TTilus> maybe sometimes chapters of a theme
[09:08:17] <Nodex> it really depends on your access patterns
[09:08:34] <Nodex> what you query for, how often you query it
[09:09:29] <TTilus> i query for books by couple of unique indices
[09:09:45] <Nodex> what are "themes" ?
[09:10:17] <crudson> TTilus: if you're dealing with books and chapters, it sounds like separate entities may be worthwhile due to size. Your themes seem to be independent of books, keep them separate too if they can apply to many books. Not totally sure I understand your datamodel...
[09:10:46] <TTilus> this is a made up terminology, i cant use real, sorry for that :(
[09:11:19] <TTilus> crudson: its only metadata, not the actual content
[09:11:19] <Gargoyle> TTilus: And how big are your books, chapters and themes?
[09:11:28] <Gargoyle> A mongo doc can be upto 16MB
[09:11:59] <Gargoyle> For reference, the entire works of shakespere in plain text = 5 meg.
[09:12:01] <TTilus> Gargoyle: one book has 10-100 chapters and 5-30 themes
[09:12:08] <Nodex> but what is a theme?
[09:12:11] <crudson> Gargoyle: sure, but you want it to be efficient across the wire too without having to babysit every query.
[09:12:47] <TTilus> Nodex: in this context you can think of it being "things relevant to particular audience"
[09:13:01] <TTilus> gotta go lunch
[09:13:01] <Nodex> tag?
[09:13:10] <TTilus> Nodex: close enough
[09:13:12] <Gargoyle> crudson: That comes down to app. I would hope that it goes without saying, that if you want a list of just titles, you don't load everything from every doc!
[09:13:14] <TTilus> brb
[09:13:33] <Nodex> I would embedd the chapters inside the book as a single doc personaly
[09:13:41] <Nodex> and as Gargoyle said only requesty what I need
[09:13:44] <Nodex> -y
[09:13:48] <Gargoyle> awww
[09:13:57] <Gargoyle> I kinda liked requesty!
[09:13:59] <Gargoyle> :P
[09:14:13] <crudson> Gargoyle: agree. I think we need more info to solve this guy's problem...
[09:15:13] <Nodex> only coz it sounds like "resty" LOL
[09:15:54] <Gargoyle> time for breakfast I think. :)
[09:16:39] <Nodex> time for second breakfast me thinks
[09:16:59] <Nodex> new laptop arriving shortly, nice i7 quad core 16gb ram sweeeeeeet
[09:17:00] <crudson> breakfast, lunch? I need to go to bed, to get some "restys"
[09:17:35] <Nodex> gotta be like 3am in washington no?
[09:20:01] <crudson> 2:18 here. 4am is my cutoff for development before my brain turns to mush...
[09:20:24] <Gargoyle> Nodex: Niiice. My i7 iMac flies!
[09:21:52] <crudson> Nodex: ssd?
[09:22:39] <Nodex> no SSD but i'll put one in
[09:22:49] <Nodex> Gargoyle : how much was your mac?
[09:23:04] <Nodex> coz my laptop was £900
[09:23:18] <Nodex> I'm guessing your mac was £1300 +
[09:34:15] <jgorset> MongoDB is not supposed to allow two keys by the same name in a single document, right?
[09:35:23] <kali> jgorset: well...
[09:35:37] <kali> jgorset: i think it actually performs these checks since 2.4
[09:36:19] <jgorset> I see, okay. I've found two keys by the same name in my document, and it's wreaking havoc on my ORM (Mongoid).
[09:37:01] <kali> yeah. with ruby, there was an issue where you could write { :a => 12, "a" => 42 } and save this
[09:37:31] <kali> the driver was converting symbols to strings, and so storing a document with two key named "a'
[09:37:31] <jgorset> I'm not sure how they came to be, though, because I can't seem to be able to create a document with duplicate keys in the mongo shell.
[09:37:44] <kali> but i think the issue has been fixed in the driver also
[09:39:15] <jgorset> That makes a lot of sense.
[09:39:49] <jgorset> I'm probably using MongoDB < 2.4 and an older version of Moped.
[09:54:11] <jgorset> I can't find anything about that in the MongoDB or Moped release notes, kali, but it makes a lot of sense.
[09:54:16] <jgorset> Thanks!
[09:59:54] <TTilus> back
[10:00:51] <TTilus> Gargoyle, crudson, Nodex: i inherited a codebase which already has books and chapters embedded inside them
[10:02:13] <TTilus> what i need is "themes" or "tags" (which judging by guidance in http://docs.mongodb.org/manual/core/data-modeling/ should be embedded inside book too) which would have many-to-many with chapters
[10:03:53] <TTilus> having a themes field (with list of theme ids) in chapter document would do the job for me
[10:04:24] <TTilus> does that sound awkward/convoluted/bad?
[10:06:15] <Nodex> it depends what you're trying to accomplish to be honest
[10:07:09] <Nodex> if each book is a single document with embedded chapters and each "theme" relates to that chapter then you should probably embedd the theme or tag with the chapter
[10:07:31] <Nodex> if you need a list of all "themes" then you should keep a separate document with an array in it that has all the chapters
[10:07:40] <Nodex> s/chapters/themes
[10:08:45] <Gargoyle> Although, you can also very quickly build such a list in "application land" if it makes the DB easier to manage.
[10:14:21] <majoh> hey, I'm trying to do a aggregate on 2.2.3, I have an array that I want to project, but only the first item in that array. I've tried {$project: {"interesting": "$thearray.0"}} etc... any ideas?
[10:15:02] <majoh> (also {$project: {"thearray.0": 1}}
[10:17:09] <TTilus> Gargoyle, Nodex: thanks
[10:23:53] <TTilus> i'll prolly go with maintaining a separate list of themes
[10:25:03] <majoh> nvm
[11:21:29] <Nodex> I must say, windows 8 is a pile of sh**
[11:35:32] <remonvv> NodeX, sorry, was afk. It's both degraded and drivers occasionally complain about not being able to establish connections.
[11:36:50] <remonvv> It seems to be that the more connections you have to mongos (and thus the shard mongod's) the worse performance gets. Might be a Java driver issue as well since the network code in that won't win any prizes either.
[11:36:56] <remonvv> We're investigating now.
[11:39:30] <`3rdEden> lol
[11:40:17] <`3rdEden> Nodex: why use window 8 in the first place?
[11:54:08] <Nodex> `3rdEden : New laptop = don't have a choice as I am not paying for another winblows licence
[13:23:16] <richthegeek> I'm having something of an issue with read speeds - I have a collection with ~200k rows in it, and I want to know the ID of all rows in the set. Unfortunately, the list is only building it about ~500 rows per second. This seems very slow?
[13:23:48] <richthegeek> code is this: source.find({}, {_id: 1}).each (err, row) ->
[13:24:14] <richthegeek> the bit inside is just adding the result to an array, so it seems to be a read issue
[13:24:18] <richthegeek> any idea what's going on?
[13:27:29] <richthegeek> ok, just used the aggregation framework ({$group: {_id: null, _ids: {$push: '$_id'}}}) and it got the result in ~300ms
[13:30:24] <richthegeek> so... what is the /disadvantage/ of using the aggregation framework? seems like it's hella faster?
[13:31:32] <Nodex> there isn't one, I can read 200k rows a lot faster than 500~/sec
[13:32:06] <Nodex> takes my script about 300-500ms to read 200k and build an array from it
[13:33:01] <richthegeek> it's off a 7200rpm HDD with an i7 and 8gb of ram so it's not exactly server spec but nor is it slow
[13:35:42] <Nodex> it still shouldn;t read at 500 rows/se
[13:36:09] <richthegeek> i know.. very curious
[13:36:13] <richthegeek> nothing else taking up much processor
[13:36:32] <richthegeek> performance seems to have degraded to about half of what it was earlier in the week :s
[13:39:05] <Nodex> maybe it's hitting disk
[13:41:45] <richthegeek> http://pastie.org/private/xc5rzovrvewzoitftazq
[13:42:10] <richthegeek> hmm, that shouldn't be hitting the track table that much anyway
[13:42:51] <richthegeek> ok, performance has picked up now (was at ~300rows/sec, now at ~900)
[13:43:06] <richthegeek> just passed 1000, no idea what's going on...
[13:43:26] <richthegeek> max out at 1382 towards the end
[13:44:23] <richthegeek> which is 1382 (read from orders, do some processing, write to orders_big, write to track) per second
[13:44:27] <richthegeek> not too shabby in the end
[13:54:24] <ThePrimeMedian> morning everyone. i've googled myself out - thought I would ask someone in here: Anyone done an activity collection? (like facebook's feed) or something of the sort? I am having a brain-fart and cannot wrap myself around the db design (like do I enter raw data or references, etc)
[13:55:40] <Nodex> I did one
[13:55:54] <richthegeek> always denormalize
[13:56:33] <Nodex> yes, never ever reference
[13:56:41] <Nodex> (in cases like this)
[13:57:22] <ThePrimeMedian> Nodex: what if the person's name changes? or something important in the data changes?
[13:57:33] <Nodex> when does a persons name change?
[13:57:47] <Nodex> it's definately NOT every day
[13:57:50] <ThePrimeMedian> true....
[13:58:46] <ThePrimeMedian> my thought would be make a template field "mark follows %s" and then have a data field
[13:58:57] <ThePrimeMedian> would that be too processor intensive
[14:13:34] <jvbe> hi
[14:14:52] <ThePrimeMedian> hi @ jvbe
[14:24:41] <theRoUS> i have a mongodb instance with dbpath=/srv/mongo and directoryperdb=true. /srv/mongo is a mounted filesystem, so it has a 'lost+found' directory. mongod is crapping out on startup because it's trying to treat that as a database directory.
[14:25:12] <theRoUS> is there any way to tell mongod to ignore lost+found? or do i need to go to directoryperdb=false (suboptimal) ?
[14:25:19] <theRoUS> Derick: ^^
[14:47:08] <starfly> kfox1111: you could use a "driver" collection that the tailers check regularly and persist which collection they should use. When you want them to switch to a new capped collection, update the driver collection to indicate that.
[14:49:34] <theRoUS> is there any way to tell mongod to ignore lost+found? i mean, having its dbpath be the top of a filesystem can't be that uncommon..
[14:50:37] <starfly> theRoUS: can't you mkdir -p /srv/mongo/data and use that instead for the mongod dbpath?
[14:51:04] <double_p> theRoUS: ignore? i've such a setup and i dont have problems about it
[14:52:12] <double_p> just to check.. nothing about lost+found mentioned in logfile aswell
[14:52:24] <orospakr> data model question: in order to avoid classic N+1 problems, is doing aggregation of (similar in notion to a SQL join) the related documents together by means of a incremental map/reduce to a "join" collection reasonable? eg., in couchdb, I'd do it with a view in my design document.
[14:54:08] <double_p> oh, but i dont have directoryperdb. sorry :]
[15:01:51] <theRoUS> starfly: i *can*, but it's going to mean making some puppet changes..
[15:15:08] <starfly> theRoUS: maybe just create a symbolic link to such a directory, e.g. mkdir -p /srv/mongo/data (as mongo user); cd /; ln -s /srv/mongo/data mongodata (as root user) -- then use /mongodata as dbpath and change puppet once, when/if you need to relocate your MongoDB data directory in the future, take an outage, move MongoDB files to the new location, modify the symlink, and restart mongod.
[15:15:54] <double_p> is mongod failing hard, if you make that dir unreadable for mongod?
[15:15:57] <starfly> theRoUS: modify the symlink means dropping existing and creating a new one
[15:16:05] <theRoUS> double_p: yeah
[15:16:30] <double_p> hm .. well, then likely no way around subdir
[15:16:47] <theRoUS> double_p: it's assuming that every directory in dbpath represents a database, because of directoryperdb
[15:17:05] <double_p> i run an instance per db, so in never came along directoryperdb
[15:17:37] <double_p> yeah, figures. but, is that only a startup error (fatal) or is just croaking and the moving along?
[15:17:45] <theRoUS> fatal
[15:18:10] <double_p> well then
[15:18:48] <double_p> subdir and/or jira ticket. i mean, almost noone would name his database lost+found? :D
[15:22:31] <starfly> TheRoUS: Good luck
[15:23:37] <theRoUS> ta
[16:25:51] <Derick> theRoUS: No idea... perhaps file it as a bug report?
[17:01:45] <maxamillion> why would commands entered into the mongo shell that work throw a syntax error when I try to run them from a .js file?
[17:01:50] <maxamillion> http://www.fpaste.org/14352/69414857/
[17:16:24] <kali> maxamillion: it's because of the "use"
[17:16:48] <kali> maxamillion: there used to be a page that explain the differences between the interactive shell and the scripting mode
[17:17:00] <kali> maxamillion: but i can't find it in the new documentation site
[17:17:20] <maxamillion> kali: ok, so what is supposed to be in it's place? ... or how do I script that?
[17:17:39] <kali> maxamillion: http://docs.mongodb.org/manual/tutorial/write-scripts-for-the-mongo-shell/
[17:17:48] <kali> conn = new Mongo();
[17:17:48] <kali> db = conn.getDB("myDatabase");
[17:18:02] <kali> it was much more clearer in the previous doc
[17:18:24] <maxamillion> ahhhh, ok
[17:18:26] <maxamillion> awesome, thanks
[17:22:17] <maxamillion> kali: yup, this is working like a champ. much appreciated
[17:24:42] <bhangm> is there any way to negate a "$and" operator ?
[17:25:02] <bhangm> something like { "$not": { "$and": [{...},{...}] }}
[17:25:13] <bhangm> (that doesn't work)
[17:41:52] <leifw> bhangm: http://en.wikipedia.org/wiki/De_Morgan%27s_laws#Negation_of_a_conjunction
[17:42:25] <bhangm> leifw: that's actually what I'm trying to do
[17:42:28] <bhangm> the original query was an or
[17:42:38] <bhangm> but sort and $or don't play well
[17:42:58] <leifw> dunno then
[17:43:02] <kali> it would be the same
[17:43:33] <bhangm> kali: what would ?
[17:43:44] <kali> with a "not" and an "and"
[17:43:53] <kali> it's not a syntax problem, it's an optimisation problem
[17:44:41] <bhangm> hmmm... I suppose you're right, it would only use 1 index in the case of the $and, correct ?
[17:46:57] <kali> i think the optimiser would give up on the $not anyway, and start scanning the collection
[17:47:35] <kali> index are better at finding stuff than excluding stuff
[17:49:53] <bhangm> good point
[17:50:29] <bhangm> I was just hoping to find some way to work around the sort + $or limitation
[17:52:28] <kali> bhangm: you just can't optimize this with a btree
[17:53:18] <kali> this does not mean you don't have options. can you show me one example docuemnt and the query you're trying to optimize ?
[18:15:49] <bhangm> kali: The query itself is not the problem, with an index on each of the $or expressions it's able to use them in parallel and comes back pretty quickly
[18:16:22] <bhangm> however, tacking a sort onto that kills the performance since it's almost essentially doing a full scan
[19:20:12] <baniir> I'm getting "WARNING: Readahead for /home/mongod/data is set to 1024KB" though I'm not sure why as I followed the steps at http://docs.mongodb.org/ecosystem/tutorial/install-mongodb-on-amazon-ec2/
[19:27:36] <ehershey> doesn't the warning give you a URL?
[19:53:46] <baniir> it does: http://dochub.mongodb.org/core/readahead
[19:55:14] <ehershey> oh
[19:55:16] <ehershey> hehe
[19:55:40] <ehershey> well did you do the readahead steps specifically from the ec2 tutorial page?
[19:56:58] <baniir> yes, as described here: http://docs.mongodb.org/ecosystem/tutorial/install-mongodb-on-amazon-ec2/
[19:57:05] <modcure> what is the l() ?
[20:12:43] <ehershey> baniir: what were the exact commands you ran?
[20:12:53] <ehershey> and did you get errors?
[20:14:32] <ehershey> the blockdev commands
[20:16:38] <baniir> blockdev --setra 128 /dev/md0 && blockdev --setra 128 /dev/xvdh1 && blockdev --setra 128 /dev/xvdh2 && blockdev --setra 128 /dev/xvdh3 && blockdev --setra 128 /dev/xvdh4
[20:17:57] <baniir> these are a part of a shell script i pass as userdata to the ec2 instance when it is created
[20:19:00] <ehershey> 128 is in blocks I think right?
[20:19:09] <ehershey> 512 byte sectors
[20:19:12] <baniir> i'm not sure if there were errors, but i've successfully used the same script on other boxes running the same os, ubuntu 12.04
[20:19:44] <ehershey> can you check your cloud-init log
[20:19:48] <ehershey> and see if there were errors?
[20:19:56] <ehershey> can you validate that those are the right filesystem devices
[20:20:07] <ehershey> and that one of them is where /home/mongod/data lives?
[20:23:10] <baniir> possibly related, i expect /dev/md0 but have /dev/md127
[20:24:27] <baniir> nothing from: # grep -Ri error /var/log/cloud-init.log
[20:26:09] <baniir> with the exception of md0 being md127, those devices are correct
[20:27:11] <baniir> they don't directly map to /home/mongod/data as i'm using lvm as described in the previous link
[20:27:27] <baniir> from df: /dev/mapper/vg0-data 48G 260M 45G 1% /home/mongod/data
[21:10:54] <ehershey> run this: # less /var/log/cloud-init.log
[21:11:01] <ehershey> and find the blockdev commands
[21:11:12] <ehershey> oh they left
[21:11:13] <ehershey> nevermind
[23:12:22] <llakey> is there a way to connect to mongo somehow and see all of the commands/queries that are being issued against mongo, something similar to `redis-cli monitor`
[23:37:54] <federated_life> possible to force initial sync from a specific member of a replica set ?