[14:25:23] <wawrek> i wanted to know if there are some possibilities of doing data processing within aggregations - turning some lists to objects (i.e. ['name', 'description'] -> {name: 'name', description: 'description'}). I know map reduce is meant to do that...
[15:54:21] <Captain_Haddock> MongoDB 2.6 and PHP 5.6: MongoCursorException: "localhost:27017: could not find cursor over collection foo.bar"
[15:54:28] <Captain_Haddock> What could be causing this? Memory issues?
[15:55:29] <Captain_Haddock> (MongoCursor::$timeout = -1;) <-- Setting this improved matters, but I'm still seeing the exception.
[15:58:11] <cheeser> check the server logs and see if/why your cursors are getting killed
[16:02:49] <Captain_Haddock> cheeser: I'm not really seeing anything that stands out. [conn17] end connection 127.0.0.1:58614 (5 connections now open)
[16:03:09] <Captain_Haddock> [initandlisten] connection accepted from 127.0.0.1:59384 #18 (6 connections now open) and lots of [clientcursormon] mem (MB) res:115 virt:975
[16:10:53] <livcd> is it possible to redirect output from mongo shell into a file ?
[16:11:25] <livcd> like > db.test.findOne().toFile(foo.json)
[16:11:28] <cheeser> Captain_Haddock: hrm. i dunno.
[16:13:39] <Captain_Haddock> cheeser: no worries. Thanks :)
[17:02:51] <watmm> Why dont see any docs on upgrading 3.0 to 3.2?
[18:11:24] <diegoaguilar> and echo "deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
[18:11:40] <diegoaguilar> so when updating ... W: GPG error: http://repo.mongodb.org precise/mongodb-org/3.2 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D68FA50FEA312927
[18:11:59] <cheeser> can you comment on that bug with this?
[21:03:06] <MacWinner> cool.. i'm waiting for the gothalice stamp of approval
[21:03:41] <GothAlice> Heh. I'm most excited about the update to text indexes. It was super basic before. Still pretty basic, but at least you can control tokenization a bit, and diacritic insensitivity is somewhat critical for multilingual apps.
[21:04:44] <GothAlice> So I _might_ be able to finally get rid of the Okapi BM-25 implementation I wrote before MongoDB had any text indexes, which I've been using to this day because it gives me full control over content extraction and tokenization. :P
[21:05:59] <GothAlice> https://docs.mongodb.org/manual/tutorial/specify-language-for-text-index/ < or not. Ugh. My documents contain multiple languages of data.
[21:06:35] <GothAlice> Ah, never mind, I see what they're doing. I initially interpreted that as per-document, but that includes sub documents. Saved!
[21:10:51] <GothAlice> "Only one positional $ operator may appear in the projection document." Rats, doesn't look like one of my followed tickets was finished enough for release.
[21:16:56] <Doyle> Hey, is indexing not multi-threaded?
[21:20:46] <GothAlice> Doyle: Index building happens one of two ways: fast blocking, where indexing must complete before anything else can happen, or background. Background can be insanely slow, so to prevent your data from being accessed long-term without indexes (while they build), after an initsync the indexes are built with fast blocking.
[21:21:05] <GothAlice> See step three which implicitly states that by blocking the normal state until completion: https://docs.mongodb.org/manual/core/replica-set-sync/#replica-set-data-synchronization
[21:22:11] <GothAlice> After initsync, multithreaded operation can resume.
[21:23:12] <Doyle> That's what I was looking for. Thanks GothAlice
[21:23:36] <GothAlice> But always remember: background index builds (post-initsync) can take geometrically more time than blocking. (Not linear with the amount of data.) To the point that you may think it's stuck. ;P
[21:32:26] <Doyle> What's the opinion of the Percona server for MongoDB around here?
[21:37:08] <Doyle> Documentation confusion with "While applying a batch, MongoDB blocks all read operations. As a result, secondary read queries can never return data that reflect a state that never existed on the primary."
[21:37:24] <Doyle> Could it be updated to say "no longer exists on the primary"? I think that's what it's getting at
[21:37:35] <Boomtime> no, that isn't the same thing
[21:37:51] <Boomtime> secondary reads can absolutely return data that no longer exists on the primary
[21:38:25] <Doyle> is that statement trying to indicate reads on data in a transitional state?
[21:38:27] <Boomtime> what the secondary promises is that you will never observe the database in a state that did not once-upon-a-time exist on the primary
[21:39:16] <Boomtime> thus, if you update document A then document B, the secondary will never let you see the document B update without the document A update already applied
[21:42:00] <Doyle> The idea of data that never existed on primary got me.
[21:42:29] <Boomtime> states that didn't exist, is what it is trying to day, not the data per se
[21:43:02] <Boomtime> certainly the secondary doesn't invent anything, but if it permitted operations out of order then things would get weird really quickly
[21:43:27] <Doyle> That'd make a funny April Fools day update :P
[22:45:58] <Doyle> Is there a way to see the overall progress of indexing after an initsync?
[22:47:17] <GothAlice> Doyle: The documentation is great; I can highly recommend reading it and searching it frequently. https://docs.mongodb.org/manual/reference/method/db.currentOp/#active-indexing-operations
[22:48:03] <GothAlice> Stack Overflow provides a more filled-out example: http://stackoverflow.com/a/15597312
[22:52:06] <GothAlice> The difficulty may be connecting before the node is ready to accept connections in order to query that. ;)
[22:52:26] <GothAlice> (Progress should also be reported intermittently in the mongod logs.)
[23:22:18] <lkannan> Hey guys! Trying to figure out an issue where mongo spins at 100% CPU. Turned on profiling and see a specific write query that are slow. strace just spits out SELECT(). I turned off my app and still see the SELECT(). Without the app turned on, mongo is at 10% CPU. I have serverStats() info as well. mongo version 2.4.9. I don't want to bombard with info. If
[23:22:18] <lkannan> you need specific things, please ask.
[23:23:29] <GothAlice> lkannan: Do you have a support contract with 10gen? If so, that would be best serviced by a JIRA ticket. 2.4 is also… ah… beyond my own ability to assist with at this stage. :/
[23:24:06] <GothAlice> Esp. since 2.4.14 is "current" for that series, and may have fixed any underlying bugs you may be hitting.
[23:25:29] <lkannan> No support contract. Figured 2.4 is too old :). I'd appreciate any pointers as to how to chase things down. Upgrade is a plausible option. I have a strong feeling this is somehow related to a bad query rather than us hitting a serious db issue.
[23:26:30] <lkannan> Slow query and serverStats() https://gist.github.com/lakshmi-kannan/1abf658bc451874b4895. What number looks ominous here?
[23:26:43] <GothAlice> Quite likely, yes, but supporting non-current is more difficult because of the possibility. Let me dig up a link for you then I'll read through that gist.
[23:28:01] <GothAlice> To see what's been fixed in newer releases in the 2.4 series since the version you're on, use "project = SERVER AND fixVersion in (2.4.10, 2.4.11, 2.4.12, 2.4.13, 2.4.14)" as an advanced query on jira.mongodb.org
[23:29:45] <GothAlice> Hmm. Looks like the problem would have existed before the traced query; a single element $pushAll against a specific _id should be an effectively O(1) atomic operation.
[23:31:12] <GothAlice> Two concerns come to mind without knowing the surrounding context: pushing values into a record may require the record to be re-sized, and subsequently moved if there isn't enough head-room. With very large documents (talking ones approaching the maximum size) this can be expensive. Additionally, if you are missing an index on _id (it can happen), bad things will happen. ;P
[23:31:29] <lkannan> Yep, the slowness of the query is a little sketch. I am not seeing any queries to db other than that when I do mongod --profile=1 --slowms=15. Missing anything?
[23:31:43] <GothAlice> So getting a dump of the available indexes, and some collection stats on average document size, may indicate trouble spots.
[23:32:15] <GothAlice> I'd set profile=2 and run the results through dex (the indexing robot).
[23:33:21] <GothAlice> There is an off chance that a supposedly fast query is what is setting off a chain of events resulting in slowdown.
[23:33:29] <lkannan> I did try to set profile=2 in mongodb.conf and I wasn't confident profiling was ON from the logs. Maybe because I was expecting the app to do while(1): ddos_mongo.
[23:34:22] <GothAlice> Heh. The logs, even in profile=2, only log slowms queries, I believe. The other queries are written to the profiler collection. Dex examines that collection.
[23:34:44] <GothAlice> (This is a good way, as well, to audit the full chain of queries from clean start to problem showing up.)
[23:34:57] <lkannan> So other than profiling, how can I look at what exactly mongo is doing? strace isn't helping much. Yep, read about the profiler collection. It's a little counter intuitive coming from other dbs.
[23:35:21] <GothAlice> MongoDB "eats its own dog food" a lot, in terms of using its own features to help implement other features.
[23:35:50] <GothAlice> You're doing a system-level strace? A la a "spin dump"?
[23:37:31] <GothAlice> Hmm; not actually familiar with the Linux side of debugging. However, I've pointed out several things you can get diagnostic information on, any one of which may result in apparent slowdown.
[23:38:36] <GothAlice> (Ensure _id is indexed, check your document size, esp. the size of the document being updated in the apparently "bad" query, and audit the full chain of queries from clean start to error state.)
[23:40:28] <GothAlice> In the latter case, Dex can help out by pointing out queries that aren't using an appropriate index.
[23:40:53] <GothAlice> (Including that push… if somehow the _id index is missing.)
[23:43:20] <GothAlice> lkannan: One thing I do notice that is interesting, is that the "supposedly bad" query is needing to update an index: trigger_instances.object_id_1
[23:44:15] <GothAlice> lkannan: Is the problem in production or development, and if in production, have you been able to reproduce on a copy of the data? If so, you might try rebuilding that index to see if updating that index during the query is the underlying problem.
[23:44:31] <GothAlice> (Generally not recommended to nuke and recreate indexes "live". ;)
[23:46:09] <lkannan> It is `production`. Trace is a nice-to-have feature. So in theory, I should be able to drop the collection to validate if that's the collection that's causing issues. That would be my last resort.
[23:48:30] <GothAlice> Well, I wouldn't recommend dropping the collection. Worst case, it can be rebuilt. (Worst-worst case is nuking the whole collection. ;) A better case is that it's just the trigger_instances.object_id_1 index that needs to be rebuilt, if that $pushAll query actually is the trigger.
[23:48:42] <Doyle> lkannan, any host level issues evident? 'iostat -xmt 1', free -m, df -h, htop, if raid - is it healthy or resilvering...
[23:49:17] <lkannan> yep, checked iostat. it is < 2% mostly.
[23:50:03] <lkannan> also, checked free -m etc. everything seems reasonable. VIRT size for mongo process is 96G. Little sketchy but I guess it's because of mmaped files?
[23:50:06] <GothAlice> There's only 112MB of indexes there, too. Should easily fit in RAM.
[23:52:11] <GothAlice> Luckily, with that small number of records and overall small index size, rebuilding the suspect index should be quite quick.
[23:53:07] <lkannan> So is there a way to rebuild a specific index? We have six indexes for that collection. https://docs.mongodb.org/manual/reference/method/db.collection.reIndex/
[23:53:43] <lkannan> Maybe that doesn't even make sense? I have no idea what goes in the index.
[23:53:46] <GothAlice> The alternative is to manually recreate the specific index.
[23:56:58] <GothAlice> cheeser: Can't wait to test out "stable" WiredTiger this week-end. I get schadenfreude from myself when getting to break things: http://s.webcore.io/3i1L2D0R3l3V