PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 20th of November, 2012

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[01:06:33] <nledon> Having some sharding issues with GridFS, sharding on files_id: https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/-nQcAPGrjMo%5B1-25%5D | any help would be greatly appreciated. Thank you.
[01:06:45] <solussd> is it possible to use a field form the $project stage in an aggregation pipeline as the value for a $match stage? e.g. {$match : {some.key $field_from_project}} ?
[02:31:06] <lonnylot> in PHP - are MongoCollection classes treated like a persistent Mongo collection (you can call the same one over and over and it uses the same info)?
[07:37:48] <vassilux> Hi alls, little question I got a collecton for daily statistics with my home made _id ? The _id build with YYYYMMDD-USER-CAUSE. I use agregation framework and want get all data for one day. How I can use $match for it ? thanks
[07:57:22] <vassilux> so I tried {$math: {'id' : '^20121120.'}} but not get results
[08:01:45] <ppetermann> $math?
[08:02:54] <ppetermann> sure you dont mean $match?
[08:03:17] <vassilux> yes sorry
[08:04:00] <ppetermann> and then you want to match a regexp?
[08:05:27] <ppetermann> you probably mean something like {$match: {id: { $regex: 'yourregexhere' }}}
[08:20:19] <vassilux> Thank ppeterman It wokrs great
[08:26:26] <ppetermann> np
[08:35:50] <[AD]Turbo> hi there
[10:58:32] <Lujeni> Hello - Someone have already encounter this error pls ? http://pastebin.com/ZgG3w9y8
[11:17:50] <Mmike> if I have plain master/slave configuration, then rs.status will not show that, right?
[11:19:01] <Gargoyle> Mmike: Not sure what you mean. Replication = primary and at least 2 secondaries?
[11:19:15] <kali> Gargoyle: i think he mean "old" replication paradigm
[11:19:33] <Gargoyle> ahh. Never used that!
[11:19:35] <kali> just... it has been deprecated for years. litteraly.
[11:22:18] <Mmike> kali, well, that's what I have :/
[11:22:26] <Mmike> can I have replSet with only two boxes?
[11:22:33] <Mmike> if so, I'll upgrade that right away
[11:22:55] <kali> Mmike: two boxes with data, one lighter box as an arbiter to avoid split brain
[11:23:46] <Mmike> kali, introducing third box is not an option at this time... can i have arbiter running on one of the boxes?
[11:24:32] <kali> nope, but it can run on anything you have around (your application server, for instance)
[11:24:33] <danielhunt> good morning again o/ have another replica set question :) with the php driver, is the additional option: 'replSet' required in order for a connection to the replicaset to succeed? if i don't use it, and point to the current master, will reads/writes continue to operate correctly?
[11:26:15] <Mmike> kali, blah, maybe tomorrow, can't do that today :/ policy issues... maybe it will be easier to actually add a third box and have 'real' replicaset.
[11:28:18] <kali> Mmike: in the mean time, i'm afraid you wont find here many people with the ancient replication system
[11:28:35] <kali> Mmike: maybe later today when people from the states will be around
[11:46:17] <Derick> danielhunt: yes, the replSet parameter is required to do failover. If you don't, and point it to master then you can write to it as long as that stays the master
[11:54:10] <danielhunt> Derick: that's what i thought alright - cheers for the response. in our case, we don't need failover. the replicaset is purely for backup purposes
[11:54:41] <Derick> danielhunt: make sure you mark the secondaries as priority:0 then, so they can never become primaries
[11:54:46] <danielhunt> yup
[11:54:47] <danielhunt> :)
[11:56:19] <danielhunt> Derick: hidden:1, also
[11:56:46] <danielhunt> Derick: you didn't happen to see my question about {vote:x.x} either, did you?
[11:56:55] <danielhunt> s/either/too
[11:56:57] <Derick> that is only necessary if you connect to the set with replicaset = name
[11:57:04] <Derick> danielhunt: nope - missed that - can you repeat?
[11:57:06] <danielhunt> https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/2_sUBAuilkY
[11:57:25] <danielhunt> that's basically the whole story. i can flesh it out here if you'd like more info
[11:58:22] <Derick> hmm
[11:58:33] <Derick> I don't actually know the answer
[11:58:40] <danielhunt> uncharted territory, i know. my main issue is that votes are essentially undocumented
[11:58:45] <Derick> yeah
[11:59:06] <Derick> I don't think even our latest replicaset deck mentions it
[11:59:06] <danielhunt> i'm sure there's a good reason for that, but being told you can't do something is a sure-fire way to make sure that people will want to do it :p
[11:59:44] <danielhunt> you haven't come across anyone looking to use replicaset purely as a backup process, i presume, which is why it's not come up.
[11:59:59] <danielhunt> or rather, you have, and you've just kept telling people to use an arbiter and not query the secondadry
[12:00:05] <danielhunt> secondary*
[12:00:09] <Derick> danielhunt: http://docs.mongodb.org/manual/administration/replica-sets/#replica-set-secondary-only-members
[12:00:21] <danielhunt> ya, came across that too
[12:00:44] <danielhunt> but it's focussed on a larger cluster, than a 1-primary, 1-backup setup
[12:01:20] <danielhunt> (which is why i was thinking: {priority:0, hidden:1} for the secondary)
[12:01:51] <Derick> danielhunt: what might work better in this case is master/slave replication
[12:02:05] <danielhunt> i thought so too, until the docs said not to use it, as its code was old
[12:02:07] <danielhunt> :)
[12:02:14] <Mmike> kali, apparently, I have replSet, but with only two boxes :)
[12:02:24] <danielhunt> http://www.mongodb.org/display/DOCS/Master+Slave
[12:02:25] <Derick> Mmike, meet danielhunt
[12:02:33] <Derick> danielhunt, meet Mmike
[12:02:35] <danielhunt> :)
[12:02:39] <Derick> you seem to have a similar setup :-)
[12:02:40] <danielhunt> o/
[12:02:54] <danielhunt> ;)
[12:03:12] <Derick> just lunch
[12:03:31] <danielhunt> heh
[12:03:35] <Derick> danielhunt: seriously though, does your setup with votes: 2 work if you take down the secondary? - does the primary stays read/write?
[12:03:58] <danielhunt> Derick: i don't know. i haven't done it yet. that's why i was asking if that's how the votes work
[12:04:06] <Derick> ah
[12:04:07] <danielhunt> Mmike: would you care to shed some light on your setup? :)
[12:04:21] <danielhunt> Derick: i don't want to fubar our data
[12:04:29] <Derick> danielhunt: yeah, I understand
[12:04:38] <danielhunt> cheers for the help though
[12:04:43] <Mmike> danielhunt, I have one master, one slave, but just relized it's not plain master/slave but replset (I concluded that because rs.status() shows me both boxes)
[12:04:55] <danielhunt> and rs.config()?
[12:05:06] <Mmike> now I want to 'failover' to the slave so I could dump/import master (that is, reinitialize from the new master) so my datadir will shrink
[12:05:44] <Mmike> primary has no votes, secondary has votes:0 and priority:0
[12:05:55] <danielhunt> you *could* setup a 3rd replica, and let it re-sync (which would be naturally condensed), and then failover to that one, no?
[12:06:37] <Derick> danielhunt: I've asked internally
[12:06:46] <danielhunt> Derick: thanks for that
[12:06:53] <Derick> now, lunch :-)
[12:06:56] <Mmike> yes, but I don't have 3rd box in place, and can't add one at this time. So I'm wondering can I acheive the same with only two boxes?
[12:07:04] <danielhunt> Mmike: 0 votes on your primary? so that means that it can't trigger an election. interesting
[12:07:46] <Mmike> danielhunt, i get votes:0 for secondray, for primary I don't have 'votes' entry in that json that rs.config() spits
[12:07:53] <danielhunt> Mmike: if you have the disk space, failover to your secondary, start a 3rd instance on your primary and let it resync, then drop the original primary and failover to the new 3rd instance. BAM. done :)
[12:08:03] <danielhunt> Mmike: ah, taht means that it's default, i believe
[12:08:04] <danielhunt> so, votes: 1
[12:08:13] <danielhunt> which makes no sense
[12:08:16] <danielhunt> cause that's deadlock
[12:08:30] <danielhunt> 1/2 <= 50%, which means no win
[12:08:44] <danielhunt> unless it's: 1/(1+0)
[12:09:01] <danielhunt> so: (1vote)/((1vote) + (0votes))
[12:09:17] <danielhunt> as opposed to the documented: (1server)/((1server) + (1server))
[12:09:40] <Mmike> hm
[12:09:46] <danielhunt> i need to hear more from 10gen about the internals of that, i think
[12:09:50] <Derick> danielhunt: might not be true...
[12:10:32] <danielhunt> Derick: well if it's a global vote-count then it makes sense. but defo need to hear more about it from ye, i think
[12:10:37] <danielhunt> Derick: go to lunch :p
[12:11:13] <Mmike> danielhunt, don't have enough space on primary, but I'll get spare box and make that one 2nd secondary, then fail over from primary, and then re-introduce primary? Will that work?
[12:12:40] <danielhunt> Mmike: i don't have an active replicaset yet, so don't take my advice as gospel :), but i'd bring in a 3rd box and let it re-sync. you'd then have a 3-box replicaset. from there, you can remove the primary altogether if the new box is powerful enough for you to run with as your new primary. otherwise, remove your first primary, wipe the data, re-add it and re-sync it, then failover to it again
[12:12:50] <danielhunt> then you'd have a condensed dataset
[12:13:01] <danielhunt> but again, talk to someone with more experience about that before doing it
[12:14:22] <Mmike> will do, thnx for the inputs
[12:14:54] <danielhunt> i'm off for lunch now too, so hopefully there'll be more light shed on the voting/server situation soon
[12:18:10] <Mmike> thnx!
[12:18:12] <Mmike> appreciate it
[12:56:47] <Mmike> is rs.initiate() run only on primary/master, or do I need to run it on a secondary before I add it to replSet?
[12:57:46] <Derick> Mmike: only once
[12:58:17] <Mmike> neat, thnx
[12:58:20] <Mmike> ok, here goes :)
[12:58:28] <Mmike> if half of the internet dies, it was me :)
[12:59:03] <Vile> Hi guys, do you know what can cause this kind of grows of non-mapped RAM for mongod? http://vile.su/pics//mms-ram-20121120-125447.png
[13:07:47] <danielhunt> Derick: any joy from the others you mentioned my questions to?
[13:08:28] <Derick> nope
[13:12:26] <Zelest> why does the mongoose thingie for nodejs require schemas? isnt that one of the cute things with mongodb to not have any schemas?
[13:14:01] <danielhunt> Zelest: there's always a schema. even when there isn't a schema, there's always a schema
[13:14:34] <danielhunt> it may not be a strict one, or one defined by a comittee, but it's a structure that you abide by in your code, and that your code expects/requires in order to navigate your data. making it a schema :)
[13:15:57] <crudson> Zelest: mongoid, mongomapper, mongoose etc are frameworks that provide drop-in replacements for traditional O/R layers for other frameworks. You can refer to attributes in a "native" way. This tends to be more helpful when saving rather then fetching, but its benefit is up to you... (open ended)
[13:18:45] <joe_p> it
[13:18:49] <Zelest> ah, makes sense.. :)
[13:25:56] <danielhunt> Derick: cheers for asking anyway. is that a 'nope, they don't know the answer', or a 'nope, no answer yet'? :)
[13:25:57] <Derick> the latter
[13:26:01] <Derick> new york is not awake yet
[13:26:23] <danielhunt> no worries. i'll idle here a while and hopefully someone will perk up who can help
[13:26:38] <Derick> I'm sure kchodorow will know
[13:58:56] <danielhunt> Derick: i've just rs.initiate()'d my primary, and then added an arbiter. this log message that i received immediately after doing this, is interesting, given our conversation:
[13:58:59] <danielhunt> Derick: Tue Nov 20 13:54:37 [rsMgr] replSet total number of votes is even - add arbiter or give one member an extra vote
[13:59:18] <Derick> heh
[13:59:40] <Derick> I *think* votes should be 2 for prim, and 1 for sec
[13:59:46] <Derick> but let's see what kchodorow says
[14:00:30] <danielhunt> yeah of course. just adding more info
[14:03:35] <danielhunt> tell me, is it safe to do an rs.reconfig(blah) while a secondary is syncing?
[14:03:50] <danielhunt> (i want to set the secondary to priority:0,hidden:1)
[14:24:17] <danielhunt> right, well it looks like it's decidedly *unsafe* to reconfig() while a secondary is synching. that needs to be in the docs :) luckily, it's perfectly safe to connect the new secondary, set its hidden/priority and reconfig while synching, then stop the secondary, wipe the data and start it again to let it start all over again
[14:54:42] <Mmike> danielhunt, I can 'freely' adjust priority for the replicasets? That is, if I issue .stepDown on a primary, and I want to choose which box to become new primary?
[15:24:34] <kchodorow> Derick, danielhunt, what's up?
[15:25:02] <danielhunt> Mmike: i'd adjust the priority before stepping down. but again, ask someone who knows :)
[15:25:05] <danielhunt> kchodorow: o/
[15:25:21] <Derick> kchodorow: https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/2_sUBAuilkY
[15:25:23] <danielhunt> kchodorow: overview of my question is here https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/2_sUBAuilkY
[15:25:30] <Derick> danielhunt: I was faster :-þ
[15:25:39] <danielhunt> well i'm prettier
[15:25:40] <danielhunt> BAM
[15:25:42] <Derick> hehe
[15:25:56] <danielhunt> :)
[15:26:42] <kchodorow> that's a pretty strut
[15:26:47] <danielhunt> damn straight
[15:27:20] <danielhunt> kchodorow: currently syncing 30 gigs of data and 30 gigs of indexes, so i can't test any ideas (not that i would. considering it's all live now :) ), but i'm interested in finding out if I can drop the arbiter i have running at the moment
[15:27:31] <danielhunt> (and mess about with voting power)
[15:28:09] <danielhunt> kchodorow: there was quite a bit of chat in here about it a few hours ago. i'll dig out some parts if you want. otherwise, we can go through it here and see if new info comes to light
[15:28:20] <kchodorow> i think i got the gist: if you want a no-failover setup, you can just give the slaves priority=0 and votes=0 like you have
[15:28:35] <kchodorow> you don't strictly need to change the primary's # of votes, 1 vote is fine
[15:28:40] <kchodorow> but it won't hurt anything
[15:29:00] <kchodorow> mongod will warn you if you have an even # of votes (which it looks like you have: 2)
[15:29:04] <danielhunt> so, the actual rules for elections is the number of available votes in the pool, and not the number of available servers (like the docs suggest)
[15:29:07] <danielhunt> ?
[15:29:19] <danielhunt> correct - it did, when i added the second node to the replset
[15:29:33] <kchodorow> since the 2 votes are both for 1 member, it cant cause ties
[15:30:34] <kchodorow> the docs suggest that? it might be because we recommend 1 vote/member, but elections are all about votes
[15:30:36] <Derick> kchodorow: so you'd configure 1 as "priority: 1, votes: 2" and 2 as "priority: 0, votes: 0, hidden: 1" ?
[15:30:54] <Derick> or even:
[15:31:01] <Derick> 1 as "priority: 1, votes: 1" and 2 as "priority: 0, votes: 0, hidden: 1" ?
[15:31:16] <kchodorow> Derick: the second
[15:31:29] <kchodorow> but the first is equivalent, just personal preference
[15:31:42] <Derick> kchodorow: docs mention very little about how "votes" work btw - i couldn't find anything useful in them :-)
[15:31:46] <danielhunt> so considering the scenario of: primary({}), and secondary({priority:0, votes:0, hidden:1}), if the secondary were to disconnect, there'd only be 1 vote in the pool, which can vote for the primary itself to remain as the leader (as 1 is still 100% of 1)
[15:31:51] <danielhunt> is that correct?
[15:32:22] <kchodorow> danielhunt: yes
[15:32:45] <danielhunt> kchodorow: yeah the docs either suggest that, or explicitly state it. either way, i was under the impression that elections are held on a server-count basis, *not* a vote-count one
[15:32:56] <danielhunt> kchodorow: what you just explained makes the whole thing make a lot more sense though
[15:32:59] <kchodorow> Derick: we've purged most mentions of votes because people get the confused with priority, but we should have an example of setting up replica sets to act like "normal" master/slave (no failover)
[15:33:14] <danielhunt> kchodorow: agreed - that's exactly what this is all about
[15:33:37] <Derick> kchodorow: yup, maybe a blog post at least?
[15:33:42] <danielhunt> kchodorow: with the massive caveat of: IF YOU FORGET YOU HAVE DONE THIS, WHEN YOU ADD MORE MEMBERS, THEN WOE BE UPON YOU
[15:33:55] <Derick> kchodorow: perhaps I'll write something about it then
[15:34:14] <danielhunt> Derick: i'll probably write something up about this myself too, when i get a chance. but having it on the official site would be a definite plus
[15:34:18] <kchodorow> Derick: yeah, i think people would find that useful
[15:34:50] <kchodorow> danielhunt: :) it should be okay, i guess, you'd just have one member you couldn't fail over to until you reconfigured again
[15:35:13] <kchodorow> it is a perk to leaving the primary with default # of votes, you won't have any vote weirdness
[15:35:17] <danielhunt> Derick: it's definitely worth mentioning that little nugget about reconfiguring while syncing, that i discovered, btw
[15:35:19] <kchodorow> if you added more servers
[15:35:26] <danielhunt> kchodorow: yeah that certainly makes sense
[15:35:32] <Derick> danielhunt: which one was that?
[15:37:26] <danielhunt> Derick: i had 1 server - restarted in replSet mode - rs.initiate() - started arbiter on same server as primary - rs.addArb() - started secondary - rs.add() - *syncing begins after a few seconds* - cnf = rs.conf(), cnf.members[2].hidden=1, cnf.members[2].priority=0 - rs.reconfig(cnf) - secondary syncing falls over silently
[15:37:38] <danielhunt> "-" is a step separator there
[15:38:03] <danielhunt> to get it all back up and running:
[15:38:12] <Derick> danielhunt: in general, don't mess when your config/servers aren't fully stable :-)
[15:38:27] <danielhunt> stop secondary mongo - rm -rf /blah/data - start secondary mongo - syncing restarts from the beginning
[15:38:42] <danielhunt> Derick: yup, but it's particularly important in this case, if you're starting from a pre-seeded server
[15:38:50] <danielhunt> which, realistically, most people will be.
[15:39:42] <Derick> danielhunt: you should specify options to add really
[15:40:13] <danielhunt> Derick: is there an example of that in the docs? i was looking for add-time options, and all i could find was a boolean flag on rs.add() to denote arbiter or not
[15:40:26] <Derick> danielhunt: on the shell: rs.help() shows:
[15:40:29] <Derick> rs.add(membercfgobj) add a new member to the set with extra attributes (disconnects)
[15:40:58] <Derick> http://docs.mongodb.org/manual/reference/method/rs.add/
[15:41:05] <Derick> actually says that there is an option...
[15:42:04] <kchodorow> http://docs.mongodb.org/manual/tutorial/expand-replica-set/#replica-set-add-member-alternate-procedure
[15:42:18] <Derick> docs are a bit wonky on rs.add() still
[15:42:25] <Derick> I'll file an issue
[15:43:02] <danielhunt> Derick: http://docs.mongodb.org/manual/reference/method/rs.add/ - the string-only param there led me to believe that it wasn't possible to do more magic with the adding. cheers for the extra link though
[15:43:24] <danielhunt> Derick: i missed the "If a document, specifies any attributes about a member of a replica set" part of that. only just spotted it :/
[15:43:52] <Derick> yeah, I don't think it's written particularly well
[15:44:03] <Derick> it should have an example for both
[15:45:16] <jawr> hey, i missed a weeks homework, does that mean i have completly failed the course?
[15:47:21] <Derick> jawr: I think you can miss a week
[15:48:31] <danielhunt> Derick / kchodorow - thanks for your help in here. really appreciate the fact that this is even possible
[15:48:45] <Derick> np!
[15:48:57] <kchodorow> np
[15:51:23] <danielhunt> it would be mighty handy if there was a better overview of the status of a sync - particularly with larger datasets
[16:06:51] <Mmike> so, if I have mongoA, mongoB, mongoC in replSet. And I connect to mongoA, always. When mongoA goes down, mongoB (for instance) will become primary. But, how am I going to connect to it if mongoA is down?
[16:07:00] <Mmike> I'm not using mongos
[16:09:39] <kchodorow> Mmike: if you use your driver's replica set connection format, the driver will look up the other members of the set and cache B and C
[16:11:04] <danielhunt> Mmike: ->connect("mongodb://mongoA:27017,mongoB:28008,mongoC:27099", array("replSet" => "mySetName"))
[16:11:07] <danielhunt> something like that
[16:16:04] <jawr> awesome news Derick, cheers
[16:16:31] <Mmike> danielhunt, kchodorow thnx
[16:17:07] <Derick> jawr: ? :-)
[16:17:50] <Derick> ah
[16:22:23] <jawr> for the info on the education shit
[16:24:44] <Derick> I wouldn't call it "shit" though
[16:24:48] <Mmike> I was introduced to the education.10gen too late :/ I'll finish the course, still
[16:24:57] <Mmike> yup, not shit at all. very informative, so far
[16:25:00] <Derick> Mmike: no worries, M101 and M102 will be run again
[16:25:12] <Mmike> neat! :)
[16:25:16] <ppetermann> Derick: i believe the kids nowadays use "shit" for "stuff"
[16:25:19] <Zelest> The education stuff is awesome.. except it scared me away.
[16:25:26] <Derick> ppetermann: I'm not a kid :-þ
[16:25:32] <Derick> and I live in the UK!
[16:25:33] <ppetermann> Derick: probably jawr is ;)
[16:25:46] <Zelest> The DBA thingie claimed that the people who was lowest score would be kicked each week.. and me not having much spare time to do the cources, that's really annoying. :/
[16:26:40] <joe_p> Zelest: so far they havent kicked anyone as I havent done a test yet but completed all 4 weeks courses.
[16:27:57] <Zelest> Ah
[16:28:02] <Zelest> Still scared me off. :/
[16:36:42] <Petrogad> is there a way with the PHP driver to tell what server in a replica set your query just fired off to? I'm trying to validate that my reads are hitting my slave servers only. I tried $mongoCursor->info() however there is no server clause in here. Any ideas?
[16:37:56] <Gargoyle> Petrogad: Do a query which will take a silly long time and see which servers mongo.log it shows up in! ;)
[16:39:00] <Gargoyle> oooh! RC3!
[16:39:03] <ckd> Petrogad: Did you turn MongoLog on?
[16:39:11] <Baribal> Hi. Anybody from 10gen around? Or anybody in general who is able to tell me a) when I can expect collection-level locking, b) what the current plans for sub-collection-level-locking are?
[16:39:16] <Gargoyle> want me to crash it, Derick :P ?
[16:39:19] <ckd> Petrogad: You can make it VERY verbose :)
[16:39:37] <Petrogad> ckd: i don't think so; I have MMS on if that would inturn enable it.
[16:39:59] <Derick> Gargoyle: yes please!
[16:40:14] <ckd> Petrogad: http://www.php.net/manual/en/class.mongolog.php
[16:40:17] <Baribal> 'Cause I've run into write-locks making read-intensive tasks take a loooong time, and I'd rather just update my mongods than rewrite all of those tasks.
[16:40:25] <Gargoyle> Derick: I have put most of the servers back to 1.2, but will see what I can do! :)
[16:40:55] <Petrogad> ckd: cheers; will investigate.
[16:41:34] <ckd> Petrogad: set level and module to ALL, and that thing will spew all kinds of fun stuff :)
[16:41:36] <ignarps> Petrogad, read this page from the php.net manual. http://www.php.net/manual/en/mongo.queries.php It explains how to select slaves as well as confirming what slave you will read from
[16:42:35] <Petrogad> ignarps: I've seen a few counter statements to each of the things on the queries page which lead me to be confused.. I can set a slave on the DB level, however another area told me that was depreciated.. then once i set the slave do I always need to do slaveOk on the finds?
[16:42:55] <Petrogad> or can I just use the cursor::$slaveOk and set that to true
[16:43:13] <Derick> ignarps: looks like we need to update that for 1.3 - actually, we have a ticket for that: https://jira.mongodb.org/browse/PHP-567
[16:43:35] <ckd> Derick: Are you confident in this one? Should I upgrade with my eyes closed? :)
[16:43:36] <ignarps> Petrogad, have you tested the code under "How slaves are chosen" ?
[16:43:47] <Derick> ckd: no - I would like you to test it though
[16:44:04] <ckd> heh
[16:45:43] <ckd> i'll do the responsible thing and at least have coffee before i blindly upgrade everything at once
[16:45:44] <Petrogad> ignarps: yea; that just looks like me manually setting the slave; just was hoping that I could see some kind of report that confirmed that it was actually hitting the slave. HOwever from that cursor it looks like it's checking if the slave Is set then to use it, and confirming what slave then was used. I'll give that a go; thank you very much for your help and knowlegde!
[16:46:05] <ckd> Petrogad: MongoLog should tell you exactly that
[16:46:12] <Petrogad> yep will do, going to do both :)
[16:46:37] <Derick> mongolog has been drastically improved in 1.3 too
[16:47:04] <Petrogad> i think my php driver is back on 1.2.6.. need to get that updated as well
[16:47:38] <Petrogad> just realized the code was using ->count(); on the server as well which from what I've read always hits the primary
[16:48:17] <ckd> Petrogad: Yeah, I was terribly excited about read preference
[17:01:52] <sukiyaki> Hello. I checked out mongodb ~1.8 era but ran into a couple of crippling issues regarding a) corruption and b) compacting a database when the database grew to more than 50% of available disk space
[17:01:59] <sukiyaki> We're back to check it out again, but are wondering if there are still reports of silent corruption happening?
[17:02:22] <sukiyaki> I know a lot of dev has happened regarding these issues
[17:02:36] <Gargoyle> sukiyaki: Can't say I've seen any corruption (using since 2.0)
[17:03:14] <sukiyaki> Gargoyle, can you give more information regarding setup, # nodes, amount of data, amount of traffic, etc.?
[17:03:20] <Gargoyle> But IIRC, compacting the DB still re-creates all the data files anew, and hence will probably still need free space equal to the size of the db
[17:03:42] <Gargoyle> 3 node rs, 15GB database, 1million monthly visits
[17:03:44] <sukiyaki> ok, so that "issue" is still there. I don't know if they even plan to fix that
[17:04:22] <Gargoyle> sukiyaki: Not really an issue, you want to copy a file from A to B, then B need enough free space to copy into!
[17:04:27] <sukiyaki> I see, ok. that is a little smaller than what we are looking at. At this point we're considering it as a secondary layer with mysql still as the backend
[17:05:24] <sukiyaki> Gargoyle, I understand how the compact works, but when you hit that situation you are literally screwed unless you do significant amount of work. it was unexpected during testing. if it's still the case, it's just something I'd need to be aware of
[17:05:58] <sukiyaki> Gargoyle, silent corruption is the main issue. we know it still happens, but the test environment we were using was using a network mounted device (big no-no) for log data (not important data)
[17:06:25] <sukiyaki> I'm wondering if there are still any reports of silent (or...loud) corruption happening
[17:14:54] <sukiyaki> is anyone able to answer on whether or not there are known corruption issues that still happen in the latest mongodb release? What time are the 10gen people on usually?
[17:15:33] <sukiyaki> I know there is an issue with high-latency disk write operations still
[17:24:19] <Petrogad> in the mongo php driver, is there a way to seek 1 ahead while in my loop? I'm trying to simulate the count call; however count hits the master while looking through all the items and hopefully just doing skip(1) on the cursor would just let me hit the next item without getting it; thus incrementing my own counter. Right now when using skip(1) i'm getting a cannot modify cursor after beginning iteration.
[17:25:25] <Petrogad> http://pastie.org/5407065
[17:30:55] <danielhunt> minutes after i quit the channel, i notice a problem with my replica-set syncing :)
[17:31:31] <danielhunt> i'm getting "key too large to index" notices in the logs for the new secondary - could someone shed some light on this? i presumed the index was perfectly fine on the primary, given that it didn't fail during indexing
[17:32:32] <danielhunt> and, is there any way for me to verify that the index is actually correct on the primary?
[17:39:02] <danielhunt> i'll need ot look into this some more
[17:39:03] <danielhunt> o/
[17:56:09] <sukiyaki> what danielhunt just asked, I'm also interested in. according to http://docs.mongodb.org/manual/reference/limits/ the max index length is 1024bytes; if the primary accepted the directive to create an index that exceeded that, without any warnings until it hit a replica, that sounds like a bug
[17:57:53] <mrpro> sounds terribe
[17:57:56] <mrpro> terrible
[17:58:32] <sukiyaki> possibly
[17:58:45] <mrpro> if index is too large
[17:58:54] <mrpro> why is it allowed in the primary in the first place
[17:59:43] <sukiyaki> mrpro, not sure if it is, what version he's using, etc. so it could be fixed in mainline... either way not a good thing if that's really how it happened
[18:00:19] <sukiyaki> especially the part about trying to verify if the index was created proper on the primary
[18:00:30] <mrpro> right
[18:00:38] <mrpro> thats a bad situation
[18:02:00] <sukiyaki> yes, really bad. but it's better to know the environment, version, distribution, etc. I think to assess properly (bad situation it might exist or have existed at all though, for sure!)
[18:03:08] <sukiyaki> when integrity of data is critical, that can't be acceptable.
[18:03:44] <termite> I am trying to export 2000 documents from a collection that has millions of documents using mongoexport. I can't seem to limit the export size. Ideas?
[18:03:47] <Petrogad> ckd: I just enabled mongo log and I'm not really seeing anything as to what / when a query was done. I see it connects to each server in my replica set (which i'm not sure if it should or not?); however i don't see a query. I see it say "saying something" on my cursor but doesn't really say where a query is happening. is there a way to further hit that?
[18:04:46] <ckd> Petrogad: can you paste bin the output?
[18:04:54] <Petrogad> you bet. cheers
[18:07:51] <Petrogad> ckd: http://pastie.org/private/4oo20bvoyvmx4uv0fp2jw
[18:12:24] <ckd> Petrogad: that's with both set to ALL?
[18:15:18] <Petrogad> ckd: yep
[18:15:43] <Petrogad> MongoLog::setLevel(MongoLog::ALL); and MongoLog::setModule(MongoLog::ALL);
[18:18:42] <ckd> Petrogad: hmm… Derick is, by definition, much better at reading those logs than I :)
[18:19:47] <ckd> Petrogad: OH, but that output looks like a pre-1.3 driver
[18:20:02] <Petrogad> doooh; sorry forgot about that; this cluster hasn't been upgraded yet
[18:20:20] <Derick> that's ok, 1.3 hasn't been officially released yet
[18:21:01] <ckd> Petrogad: i don't think read pref support is available before 1.3
[18:21:16] <Derick> correct
[18:21:20] <Petrogad> ckd: gotcha; is it normal though that it looks to be connecting to both of those?
[18:21:21] <ckd> Petrogad: so, at best, setting it won't have any effect
[18:21:38] <Derick> the 1.2 mongolog isn't very useful to see to which machine a query was ran against sadly
[18:21:44] <Petrogad> ok
[18:22:00] <rpcesar> im trying to perform a fairly basic mongo update query (im using rockmongo for visual inspection). I am trying to "tag" a key/val onto two seperate lists located under 2 specific keys. However, the keys are never getting added (it says it effects all the documents though). here is the query that im trying: http://pastie.org/5407335
[18:22:19] <rpcesar> can anyone figure out what im doing wrong or missing in this?
[18:22:29] <Derick> rpcesar: set with $ ?
[18:22:33] <Derick> why do you need the $?
[18:22:44] <rpcesar> I am trying to effect all sub documents in a list
[18:22:45] <Derick> (I meant in phones.$...
[18:23:03] <Derick> ah, I don't think you can do that in one query
[18:23:05] <rpcesar> right, because thats meant to update phones.0.x and phones.1.x etc. there can be any number of documents in that list
[18:23:14] <Derick> yeah, that doesn't work
[18:23:38] <Petrogad> is it worth upgrading to the 1.3 driver yet? or should I hold off
[18:24:03] <Derick> Petrogad: it's RS support is a lot better than in 1.2 already, but not really ready
[18:24:13] <Petrogad> i see it hit RC3 today
[18:24:15] <Derick> (ready to be released I mean)
[18:24:27] <Petrogad> i mean should i use it in production or should i just hold off
[18:24:41] <dilshod> Anybody can help me?
[18:24:43] <dilshod> I'm new in mongo and after installing in shell when running command mongo, i get error Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
[18:24:49] <rpcesar> ive seen and read quite a few examples of the $ operator in set operations however
[18:24:49] <rpcesar> http://stackoverflow.com/questions/7916476/mongodb-add-new-field-value-in-existing-embedded-document-with-multiple-l
[18:25:02] <Derick> dilshod: did you start the server as well? "mongo" is just the client, like the "mysql" client
[18:25:24] <dilshod> how can i do this?
[18:25:24] <Petrogad> dilshod: confim it's started by doing mongod then you can connect using mongo
[18:25:41] <Derick> rpcesar: yeah, you can use use with it a find/update
[18:25:49] <Kilian]> Hi, iam asking here again, did in #rubyonrails before but got no help. My problem is i cant access all objects of the Address model https://gist.github.com/f27436b06f63d444533e#file_b.rb L13 is this related to the fact that its embedded in the practice class?
[18:25:51] <Derick> but never more than one item at a time
[18:26:12] <rpcesar> http://www.mongodb.org/display/DOCS/Updating#Updating-The%24positionaloperator
[18:26:30] <Derick> dilshod: please read http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/
[18:26:40] <dilshod> mongod gives me ERROR: dbpath (/data/db/) does not exist.
[18:26:42] <dilshod> Create this directory or give existing directory in --dbpath.
[18:26:43] <dilshod> See http://dochub.mongodb.org/core/startingandstoppingmongo
[18:26:45] <dilshod> and
[18:26:56] <Derick> dilshod: so create that directory
[18:26:57] <dilshod> ok, Derick. I will read
[18:27:00] <sukiyaki> dilshod, do exactly what the error message says
[18:27:09] <Petrogad> :)
[18:27:18] <Derick> rpcesar: yeah, $ is only for use when a match found a specific sub-array element
[18:27:34] <dilshod> Where i must create this dr?
[18:27:36] <Derick> rpcesar: you will need to do this differently - possibly scripted in your favourite language
[18:27:48] <rpcesar> gah, ok
[18:27:53] <Petrogad> dilshod: you can create any directory you want to store the info; that just suggested /data/db/
[18:28:01] <Derick> dilshod: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/ explains it all
[18:28:04] <sukiyaki> dilshod, exactly where it says... you can do it in /data/db if you're just testing, depending on your partitions... or specify a dir in --dbpath
[18:28:30] <rpcesar> so I couldent test for say existance ($exists) in the query and make it work?
[18:29:58] <sukiyaki> why is the default /data/db/ out of curiosity?
[18:30:09] <sukiyaki> that is a non-standard folder to begin with....
[18:30:13] <Derick> sukiyaki: that, I don't know :-)
[18:30:32] <Derick> rpcesar: sure, you can - but only one array element at a time
[18:30:57] <rpcesar> ah, so thats the restriction, got it
[18:31:06] <rpcesar> thanks for your help Derick, that makes more sense now
[18:31:09] <Derick> np
[18:37:20] <rpcesar> ok, part of the problem im experiancing is some of these documents are rediclously large, the table of ~3000 takes up nearly 4mb a piece, and pulling the entire set of objects onto the stack is unacceptable from a performance aspect.
[18:37:51] <Petrogad> is the only way to advance the cursor by saying getNext() ?
[18:38:04] <rpcesar> oh, so its only pulling them one at a time?
[18:38:26] <Petrogad> rpcesar: yea, i would make it so that you pull and work with one at a time
[18:38:39] <rpcesar> i generally just use an iterator over it (which I presume wraps that) but I was under the indication (from memory consumption and heap allocation) that it was pulling the entire collection
[18:38:47] <rpcesar> (when i pulled all objects obviously)
[18:38:48] <dilshod> All is working. Thanks
[18:38:57] <Kilian]> can anyone tell me how to access all instances of an class thats used as emdebbed class? Classname.all doesnt work ...
[18:39:09] <Petrogad> rpcesar: it depends on how you're using it; if you iterate over the cursor and pull one off at a time you're pulling them off and storing it in memory elsewhere
[18:39:47] <Petrogad> rpcesar: what are you trying to accomplish?
[18:39:50] <rpcesar> Petrograd: yea, sounds like I may have a leak then, that obviously is not the intended behavior as these are a series of independent upgrade actions
[18:40:03] <Petrogad> yea.. I'd look at things around it.
[18:40:35] <rpcesar> Petrogad: im attempting to "tag" a key value pair onto all existing subdocuments (stored within a list on a document) to make some things forward compatible
[18:41:05] <Petrogad> rpcesar: gotcha; i was fairly certain there was a way to write an aggragate method to do that.
[18:41:12] <rpcesar> Petrogad: originally I thought I could do these with a single query using $set and positional operators, but @Derick informed me it was not possible and I need to script that logic out
[18:41:34] <Petrogad> rpcesar: yep, I remembered writing some kind of map reducer to work through it in the past.
[18:41:40] <Baribal> Hi again. Anybody around now who can tell me a little about the near future of concurrency?
[18:42:42] <rpcesar> im contemplating writing a jira feature request on the matter, but i'm not sure any of the impact on the internal design so it may be a waste of time
[18:43:04] <Derick> rpcesar: It's quite possible it already exists as a FR
[18:43:55] <rpcesar> Baribal: is that a trick question?
[18:44:39] <Baribal> rpcesar, no. I'd really like to know whether I can expect collection-level locking and maybe document-based locking this or next quarter.
[18:45:23] <Baribal> 'Cause right now, write locks are killing me.
[18:45:47] <Kilian]> can this line work? " @practices.where(:"addresses.country" => params[:country].upcase) " How can i access the address class instances correctly?
[18:46:12] <Petrogad> Baribal: I thought that in 2.2.1 that was fixed; what level is your DB at?
[18:46:46] <Baribal> Petrogad, actually I rifled through the changelogs and only found db-level locking instead of global locking.
[18:47:05] <Baribal> Petrogad, What do you mean by your question?
[18:47:35] <Petrogad> Baribal what version of mongod currnetly running on *
[18:47:46] <Baribal> 2.0.2
[18:48:21] <Derick> Baribal: 2.2 has a lot of concurrency improvements
[18:48:29] <Petrogad> Baribal: http://docs.mongodb.org/manual/release-notes/2.2/#changes
[18:48:38] <Derick> not only db level locks, but also massively improved "yielding"
[18:49:19] <Baribal> Derick, Petrogad, yes, as it says, db-level instead of global locking.
[18:49:35] <skiz> yeah it changed from instance to db level locking. we worked around the issue by sharding some collections and avoiding large document rewrites (mongo writes the whole document to disk on save), that and pushing reporting level writes to mysql to lower the write locks even further.
[18:49:40] <Baribal> But I *realy* need collection and document level.
[18:50:01] <Derick> Baribal: how do you know that for sure? the yielding in 2.2 makes this a lot less of an issue
[18:50:17] <Derick> you really need to test it before you can claim you *really need* collection/document level locking.
[18:50:30] <Derick> That said, more fine grained locking is still on the list.
[18:50:40] <Baribal> Derick, I get around 50% locking even at good times.
[18:51:03] <Derick> In 2.0
[18:51:12] <skiz> Baribal: have you tried sharding your hot collections?
[18:51:23] <rpcesar> Baribal: we had write locking issues at one time, but we generally aggragate all actions to a worker queue manually (redis) and shove everything through without "safe". not ran into an issue thus far.
[18:51:50] <Baribal> Yes. Those changes have been in 2.0, though, according to a talk by 10gens CEO.
[18:52:06] <Baribal> skiz, I wish. My boss said "no more servers." :(
[18:52:57] <rpcesar> (over 1 mil total documents spread out over ~30 collections, one collection having over 400k documents)
[18:53:26] <Derick> Baribal: concurrency improvements are in 2.2, not so much in 2.0
[18:53:32] <Baribal> Also, I have 1 db per daemon, so no improvement there. Stuff's messed up around here...
[18:54:55] <skiz> Baribal: it's not the size generally that's an issue, its the size of the documents and number of writes.
[18:55:40] <skiz> size of documents as in the full document being rewritten to disk each update.
[18:56:15] <Baribal> skiz, hundreds of writes per second. I've got plans in place to reduce those, but it'd take quite a while to implement those, so I'd love to know whether the situation might improve before I'm done rewriting those tasks.
[19:06:21] <Kilian]> can someone help me and tell me how to access all instances of an model thats used as embedded model?
[19:07:29] <Baribal> BTW, I just deactivated the processes which are responsible for about 40k writes per hour, and performance suddenly increased MASSIVELY. Sadly, that's even only about half our write load.
[19:07:53] <Baribal> Can't keep them deactivated too long, though. :(
[19:43:33] <ineb> iam new to mongodb. i have a scenario simple with users, categories and images. images are in categorys and user own images and categorys. what is a good schema? three collections (user,categories,images) or only one with all data inside. i also need gridfs for the images
[20:12:42] <sirious> if foo = db.collection, and i do bar= foo.find(), then foo.close, can bar still be iterated over normally for results?
[20:12:54] <sirious> i want to use timeout=False for a long running migration script
[20:13:08] <sirious> and i want to close the cursor properly
[20:25:47] <yud1z> hey everybody
[20:27:37] <ineb> hoi
[20:27:55] <yud1z> i have a problem here
[20:27:59] <yud1z> http://pastebin.com/i5ZUQNm6
[20:28:56] <yud1z> how i sort and limit the [stream]
[21:31:16] <McSorley> Currently running mongos on an EC2 micro instance, /journal files are eating up disk space, Is there a way to reduce the preallocation?
[21:50:54] <grahamhar> try --smallfiles
[21:51:40] <Derick> it's my favourite switch for playing around too
[21:51:56] <Zelest> uhm, anyone using nodejs and/or expressjs here? :/
[21:52:50] <Zelest> trying to figure out how get a global object/variable for my collection object.. feels a bit odd to connect to mongo on each web request..
[21:53:05] <Zelest> sure, the driver caches the connection and all, but it makes my code far from dry. :-)
[21:54:56] <McSorley> grahamhar: was doing a bit more research, so what I have done is.. set "smallfiles=true" in mongodb.conf, stopped mongod service, now I intend on removeing the journal files and restarting mongos, on the right path…?
[22:22:09] <grahamhar> so i think smallfiles will apply to all dbfiles
[22:22:20] <grahamhar> if possible can you start from scratch?
[22:22:44] <grahamhar> dump any databases then import after restarting with that setting
[22:58:56] <Gargoyle> ping Derick or bjori