PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Saturday the 23rd of May, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:40:53] <Antiarc> In both the python and ruby drivers, if you connect to an RS with an invalid RS name, the connection succeeds, but leaves you with an empty cluster that fails all requests. Is there any scenario under which such a connection could become available? AFAIK, nodes can't join an RS that don't share the RS's name, so it seems like it would make sense to fast-fail and throw an exception if you connect to an RS with the wrong RS name, no?
[00:42:02] <Antiarc> It makes sense for sharded setups, since a new shard with that RS name could join the cluster, but when connecting directly to an RS, I don't think that's a possibility?
[00:44:48] <Boomtime> Antiarc: it doesn't make sense for sharded clusters either, you must not connect to shards
[00:45:33] <Antiarc> You could connect to a mongos that doesn't have any nodes for a given RS, but which could have new nodes come online during the connection's lifetime though, couldn't you?
[00:45:40] <Boomtime> no
[00:45:56] <Boomtime> when you connect to a sharded cluster you connect to a mongos only
[00:46:12] <Boomtime> you do not need, or every know, the names of the replica-sets forming the shards
[00:46:20] <Antiarc> Oh, right, okay
[00:46:26] <Antiarc> Right, right
[00:46:34] <Boomtime> what you describe sounds odd, a replica-set name isn't particularly important except for verification of what you've connected to
[00:46:58] <Boomtime> all the members must have the same name, but you can omit the name entirely from a connection-string and it will still work
[00:47:36] <Boomtime> i would certainly expect a driver to either validate the replica-set is what you expect (throw an error if wrong) or ignore it entirely
[00:47:42] <Antiarc> Yup! I'm just trying various iterations of connection params, and when you specify a replicaset name that doesn't match the RS you connect to, it permits the connection but leaves you with an unusable client
[00:48:07] <Antiarc> It ignores it, since none of the nodes in the RS match the provided RS name, so all server selection operations return an empty set and eventually time out
[00:48:16] <Boomtime> when you "permits the connection", have you tried any operations?
[00:48:28] <Antiarc> Yes, things like a find time out during server selection
[00:48:38] <Boomtime> a time out?
[00:48:52] <Boomtime> that seems unpleasant
[00:48:58] <Antiarc> Yeah, the client attempts to find a valid server for a given read preference, and gives up after some time if it can't
[00:49:18] <Antiarc> But if the RS name is wrong there will *never* be a valid server, so I think it should probably fast-fail at connect time
[00:49:24] <Boomtime> and it's doing a time out, not merely "couldn't find suitable server"?
[00:50:00] <Antiarc> Yeah, it's "can't find a suitable server" - pymongo.errors.ServerSelectionTimeoutError: No replica set members available for replica set name "foobar"
[00:50:04] <Boomtime> you can't fail at conect time, because no operation is in flight - that is, the driver doesn't know your intention yet - but it can fail quickly the moment you give it an operation to perform
[00:50:07] <Antiarc> (but it happens after a protracted timeout)
[00:50:41] <Antiarc> It seems like server selection should complain if the list of servers is empty prior to read preference/tag set filtering
[00:51:14] <Boomtime> well, that is probably defined behavior, it's hunting.. but i tend to agree that it should be able to detect something is amiss the moment a seed server responds with a different replname than the expected one
[00:51:29] <Antiarc> When you connect, it polls the RS for the list of nodes, and then filters them by RS name - if the result of that filtering is empty, it could throw an exception
[00:51:42] <Antiarc> connect-time is wrong, more like "client instantiation and topology-discovery time"
[00:51:56] <Boomtime> right, i was about to say something like that :-)
[00:52:11] <Boomtime> the connect line rarely does anything in most drivers, it's just object instantiation
[00:52:39] <Antiarc> Okay. I'll open an improvement ticket on the Ruby driver. Happy to open one on the Python driver as well, but I'm just using it to consistency-check the Ruby driver's behavior :)
[00:54:44] <Boomtime> yeah, i'd think improvement is the way to go, clearly the driver can fail fast the moment it gets a response on the seed list whose replname is different to expected - that condition minimally means the connection-string contains a mistake, plowing on from that point is silly
[00:56:42] <windows7_> im starting to hate the dev that came before me
[00:56:51] <Antiarc> Also, I'm not sure if it's specced behavior or not, but the Ruby driver isn't resolving node names to IPs or anything - if I connect via localhost, I end up with 2 nodes in my cluster, one named localhost and one named luna (my machine's name), which seems like it might cause issues at some point.
[00:57:15] <Antiarc> Mongo::Client.new(["localhost:27019"], replica_set: "kerrigan", read: {mode: :secondary_preferred}).cluster => #<Mongo::Cluster:0x2386 servers=[#<Mongo::Server:0x2388 address=luna:27019>, #<Mongo::Server:0x2390 address=localhost:27019>] topology=Replica Set>
[00:57:40] <Antiarc> Both those servers in the servers list are the same node, but the RS names it "luna", and the seed name given was "localhost"
[00:58:00] <Antiarc> Still going through the selection code to see if it might cause a problem, but it seems like it might be unintended
[00:59:50] <windows7_> what is writeConcern?
[01:01:09] <Antiarc> It's the parameter that determines the durability required for the write to succeed
[01:01:16] <Antiarc> http://docs.mongodb.org/manual/core/write-concern/
[01:02:16] <Boomtime> @Antiarc: generally speaking, drivers use the seed list only temporarily, once they get some responses from the servers the seed list should effectively be thrown away
[01:02:43] <Boomtime> there is nothing stopping a driver from retaining the seed list for it's own purposes
[01:03:10] <Boomtime> with that said, using different names in the seed list than what is in the replica-set configuration will lead to trouble sooner or later
[01:07:03] <Antiarc> It looks like it's adding the seeds unconditionally here: https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/cluster.rb#L102
[01:07:14] <Antiarc> And then just appending to that list in #add
[01:09:24] <Antiarc> (I'm working on tracking down where the cluster node list is actually managed during discovery)
[01:09:55] <Boomtime> i don't believe that is illegal in the driver spec, but it's probably not a good idea - i know most drivers don't mix the lists like that
[01:11:43] <Boomtime> indeed, C# driver appears to have addressed this specific condition: https://jira.mongodb.org/browse/CSHARP-1283
[01:12:06] <Antiarc> Oh, the Ruby driver has this addresses array on the cluster
[01:12:17] <Antiarc> But it never resolves the seeds and adds them
[01:13:21] <Boomtime> not sure what you mean - but seeds are not directly resolved to be "added" to the topology - connections are made using the seed list, but members are added to the topology based on what the servers at the end of those connections actually report
[01:13:53] <Boomtime> i.e a config is requested, and the topology is discovered from the other side
[01:14:32] <Antiarc> Yup! I'm saying that the deduplication is handled by resolving each discovered node and keeping a list of IP addresses to know which nodes are known, but no lookup is done for seeds and seeds are unconditionally added to the servers list
[01:14:44] <Antiarc> The right solution is likely to just split the lists
[01:14:59] <Boomtime> right
[01:15:32] <Boomtime> the only real reason to ever try to match between these two lists is to utilize the existing connections made using the seed names
[01:16:18] <Antiarc> Well, and you could do that with address resolution anyhow
[01:16:35] <Boomtime> the safe way of doing it would be close all connections made from seed list names and open new ones to the names given in the topology as discovered - but that's wasting connections then
[01:17:29] <Boomtime> so drivers do attempt name match up, using address resolution when available, and de-dup'ing, associating, etc as you say
[01:33:42] <aniasis> Boomtime, I want to take a large set of data and shrink it to views. Those views would be represented as XML and stored as documents in some sort of content repository. Is that possible with MongoDb?
[01:35:07] <Boomtime> i would suggest storing as JSON instead since you'll have a much more powerful query language then, but otherwise yes, mongodb is a document store, the rest is just formatting
[01:38:08] <aniasis> I don't want to use mongoDB's query language to traverse the documents only access them.
[01:39:19] <Boomtime> ok, then you'd be using it as a file system basically
[01:45:05] <aniasis> yes
[01:45:30] <aniasis> So can I store the XML?
[01:47:23] <Boomtime> of course, you can store anything you like
[03:24:39] <_ari> can i use the import command in nodejs?
[03:24:49] <_ari> i want to import a .csv file to mongo every hour
[03:24:57] <_ari> updating a collection
[03:25:09] <_ari> i want it automatic
[04:16:33] <Streemo> In an update query, does $unset override $inc ?
[04:17:47] <Boomtime> i think you'll get an error if you include both
[04:17:54] <Streemo> for example collection.update({name:"bob"},{$inc: {field: 5}, $unset: {field: ""}}) will Bob have a field with value 5?
[04:17:55] <Boomtime> (on the same field )
[04:18:10] <Boomtime> pretty sure the parser will bork
[04:18:13] <Streemo> ah
[04:18:20] <Boomtime> let's try!
[04:19:29] <Boomtime> "code" : 16837,
[04:19:30] <Boomtime> "errmsg" : "Cannot update 'field' and 'field' at the same time"
[04:19:42] <Streemo> I tried it but mine worked
[04:19:48] <Boomtime> what version?
[04:20:08] <Boomtime> was a document actually matched and modified?
[04:20:17] <Streemo> yes
[04:20:27] <Streemo> the unset overrid
[04:20:27] <Boomtime> what version?
[04:20:36] <Streemo> 3
[04:20:47] <Boomtime> what? i just tried it on 3
[04:20:54] <Boomtime> i copied your exact line
[04:21:07] <Streemo> ah, 2.6.7 i guessed wrong
[04:21:09] <Boomtime> inserted a doc first as {name:"bob"} nothing else
[04:21:14] <Boomtime> ok.. not sure there
[04:21:19] <Boomtime> sounds like a bug that was fixed
[04:22:07] <Boomtime> 2.6.9 doesn't work
[04:22:08] <Boomtime> "code" : 16837,
[04:22:09] <Boomtime> "errmsg" : "Cannot update 'field' and 'field' at the same time"
[04:22:41] <Boomtime> 2.6.5 doesn't work:
[04:22:42] <Boomtime> "code" : 16837,
[04:22:42] <Boomtime> "errmsg" : "Cannot update 'field' and 'field' at the same time"
[04:22:55] <Boomtime> i'll need to grab 2.6.7..
[04:23:24] <Boomtime> can you paste the exact update you tested with in the shell, and the reponse you got?
[04:23:45] <Streemo> No, youre right - it's not working on mongodb.
[04:23:51] <Streemo> It is however working on minimongo
[04:24:08] <Streemo> which is a client side implementation of mongodv
[04:24:14] <Streemo> https://www.npmjs.com/package/minimongo
[04:24:40] <Boomtime> uh-huh..
[04:24:40] <Streemo> in the browser, it works - but not in the shell
[04:25:23] <Boomtime> you should talk to whoever wrote that
[04:25:35] <Streemo> yeh
[04:25:38] <Boomtime> looks like they don't intend to be fully compatible though
[04:37:22] <aniasis> Boomtime, I just deployed mongoDB onto Google Cloud
[04:37:39] <aniasis> there is a notion of arbiter and 2 main instances
[04:37:56] <aniasis> can I import my dB through the arbiter or do I have to import into both
[04:39:24] <Boomtime> you have a replica-set?
[04:40:09] <Boomtime> http://docs.mongodb.org/manual/core/replication-introduction/
[04:40:46] <Boomtime> in a replica-set you can only write to the primary instance (whichever member that is at the time)
[04:41:13] <Boomtime> your data will be replicated, for the purposes of durability, to the other data bearing members of the set
[04:41:33] <Boomtime> an arbiter is not data-bearing, it exists solely to cast a vote in elections, so you will never need to connect to it
[05:59:27] <aniasis> thanks Boomtime
[07:47:33] <techie28> Can I not install the latest version of mongodb on debian jessie?
[08:11:55] <joannac> techie28: https://jira.mongodb.org/browse/SERVER-18329
[12:07:08] <ChALkeR> Is there any ETA for debian stable packages at repo.mongodb.org?
[18:18:55] <svm_invictvs> WIth GridFS is it possible to access a chunk directly?
[18:19:15] <svm_invictvs> Just to say, byte[] getChunk(int chunkNumber);
[18:19:22] <svm_invictvs> or something similar
[18:34:57] <svm_invictvs> Actualliy...
[18:37:20] <svm_invictvs> WHy doesn't a grid fs stream support seeking?
[18:58:17] <StephenLynx> you could try and access db.fs.chunks svm_invictvs
[18:58:42] <StephenLynx> db.fs.files hold the metadata
[19:29:31] <loadh> hello
[19:30:03] <loadh> i'm trying to get the value of a 'virtual' function to output in the JSON my Web App returns as a result of a query to my MongoDB instance
[19:30:08] <loadh> is this possible?
[19:30:17] <loadh> I'm using NodeJS with Mongoose
[19:31:21] <loadh> I've defined the virtual function 'isOpen' and would like the value as a key / value in the JSON, but it doesn't appear in the JSON..I tried setting: Schema.set('toJSON', { virtuals: true })
[19:33:10] <StephenLynx> virtual function?
[19:33:20] <StephenLynx> js doesn't even have classes to have virtual methods.
[19:46:16] <loadh> StephenLynx: I must only be talking about Mongoose then
[19:46:25] <loadh> http://mongoosejs.com/docs/2.7.x/docs/virtuals.html
[19:47:54] <loadh> and what I meant was what they call 'virtual attributes'
[19:51:17] <StephenLynx> mongoose is really bad.
[19:51:20] <StephenLynx> I suggest not using it.
[19:51:42] <loadh> my whole system is build on it
[19:51:46] <loadh> built
[19:51:52] <loadh> i'd have to re-write everything
[19:52:01] <StephenLynx> hm
[19:52:06] <loadh> which i can / will do (when i have time...) but for now i'm stuck with it
[19:52:18] <loadh> what's the alternative anyway?
[19:53:20] <StephenLynx> the regular node.js driver.
[19:53:29] <StephenLynx> some benchmarks show a 600x better performance.
[19:53:37] <StephenLynx> and it doesn't do any craziness.
[19:56:05] <StephenLynx> been using it about a year now constantly. great piece of software.
[19:57:13] <loadh> there was some reason why i didn't use it the time I built this thing...
[19:57:25] <loadh> will go back to it based on your advice
[19:57:33] <loadh> but right now i need to get this virtual attribute out!
[19:58:37] <StephenLynx> no idea.
[19:58:41] <StephenLynx> I have never touched mongoose.
[19:59:05] <StephenLynx> and from what I noticed, I am the only node/io dev here giving advice. I suggest trying mongoose's channel.
[20:01:34] <loadh> yep in there now, thanks StephenLynx
[20:01:43] <StephenLynx> np
[20:05:35] <loadh> StephenLynx: Is there a similar concept in the native driver then?
[20:05:52] <loadh> the idea is a field that isn't persisted but is computed on retrieval
[20:06:10] <loadh> i want to add a value to the JSON i return from my Web Service, that isn;t persisted
[20:06:29] <loadh> because persisting the value would be pointless since it's date / time related
[20:06:42] <StephenLynx> afaik, yes. you can make up stuff on the go with projection.
[20:06:43] <loadh> i guess i could iterate the result set and add the vakue
[20:10:56] <StephenLynx> well, projection operations are limited.
[20:11:51] <StephenLynx> you might be better with doing this work on the application.
[20:17:43] <loadh> StephenLynx: ok, so iterate the resultset and compute?
[20:17:59] <loadh> it's basically a timezone computation
[20:18:39] <StephenLynx> yeah, I don't think you can do that directly with the driver.
[20:18:59] <loadh> the 'Business' has an opening start and end time (integers) and i want to provide an isOpen field in the JSON for that business...all dates are in UTC and I have a timezone field with the business's timezone
[20:19:04] <loadh> ok
[20:22:22] <StephenLynx> and protip: any ODM won't do it magically, it will just perform additional operations on the driver.
[20:22:44] <StephenLynx> so the load is the same.
[20:30:18] <loadh> i see, so iteration over the result set is no biggie
[20:32:39] <StephenLynx> if your result set is not too large, no.
[20:33:17] <StephenLynx> keep in mind that holding up CPU is node/io's akilles heels.
[20:39:17] <rOOb> Anyone here using mongoose? I create a schema using a custom get and set function to format the field, but the get never seems to be called. I'm using this:
[20:39:19] <rOOb> amount: {type: Number, get: getRealPrice, set: setPrice },
[20:40:00] <rOOb> getRealPrice is: return (num/100).toFixed(2); and setRealPrice is: return num*100;
[20:41:07] <rOOb> If I enter "1.99" it's store in the db as 199. When I get it from the database it's still 199. It's never formated according to getRealPrice
[20:46:31] <StephenLynx> I suggest not using mongoose.
[20:46:55] <StephenLynx> it causes loss performances of about 600% and doesn't quite follow mongo's specifications on some aspects, like _id
[20:58:52] <rOOb> StephenLynx Hmm. I'm new to the node/express/mongo world. Is there a "better" alternative to mongoose that you know of?
[21:04:03] <StephenLynx> the node.js driver.
[21:04:08] <StephenLynx> and express is awful too.
[21:04:24] <rOOb> o_0
[21:04:28] <StephenLynx> vulnerabilities, slow
[21:04:33] <rOOb> Hmmm
[21:04:45] <rOOb> I thought express was the defacto library
[21:04:48] <StephenLynx> nah
[21:04:54] <StephenLynx> complete crap
[21:04:57] <rOOb> lol
[21:05:06] <rOOb> What is better?
[21:05:12] <StephenLynx> any framework is bad.
[21:05:20] <StephenLynx> bloated and unnecessary.
[21:05:33] <rOOb> :o
[21:05:45] <rOOb> So...your one of "those" guys ;)
[21:05:57] <StephenLynx> that can actually code?
[21:06:00] <StephenLynx> yeah.
[21:06:04] <StephenLynx> brb anime
[21:06:06] <StephenLynx> :3
[21:06:06] <rOOb> lol
[21:19:16] <Streemo> I've got two options: return .find()with fields: {field1: 1, field2: 1, field3: 1,...} OR I can restructure the document to have field_i as a subfield of a parentField, so I only have to do: .find() with fields: {parentField:1}. from your experience, does this offer performance boost
[21:21:40] <Streemo> if i wanted to sort, is it moreefficient to sort by field1: -1 or by parentField.field1: -1? does the extra nest level help projection speed more than it hurts sort speed?
[23:29:22] <asturel> hi, i try to compile https://github.com/mongodb/mongo-cxx-driver
[23:29:32] <asturel> when i use -ssl it cannot find the boost regex.. while if i dont it can
[23:30:15] <asturel> https://bpaste.net/show/4fbd8f928af0