Closed (fixed)
Project:
MongoDB
Version:
6.x-1.x-dev
Component:
Watchdog
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2010 at 07:39 UTC
Updated:
9 May 2011 at 18:51 UTC
Jump to comment: Most recent file
Thanks for all the work on this module, I'm trying it out now for watchdog. One thing I noticed is that the collection name variable used for mongodb_watchdog is a very generic "mongodb_collectionname". It works because the other components use a different convention, but if this module expands for other purposes, each component should have its own variable. So mongodb_watchdog should use mongodb_collectionname_watchdog, for example.
The attached patch changes the name to mongodb_collectionname_watchdog in the code and with an update hook.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 971232-removed-collection-names-1.patch | 6.04 KB | thebuckst0p |
| #13 | 971232-removed-collection-names.patch | 3.14 KB | thebuckst0p |
| #6 | mongodb-watchdog-collectionname_1.patch | 3.17 KB | thebuckst0p |
| #5 | mongodb-971232-remove-vars.patch | 1.03 KB | thebuckst0p |
| #1 | mongodb-watchdog-collectionname.patch | 3.17 KB | thebuckst0p |
Comments
Comment #1
thebuckst0p commentedLooking at this further, it seems that a similar naming convention was attempted, but not applied consistently: the settings form in
mongodb_watchdog_access_logging_settings()sets a variable "mongodb_watchdog_collectionname", but then never uses that variable, using (prior to my patch) the generic "mongodb_collectionname" to connect.I think the naming convention mongodb_VARIABLE_COMPONENT makes more sense, but to work better with the mongodb_watchdog_VARIABLE convention used in the module's other settings, I've re-rolled the patch to use mongodb_watchdog_collectionname (instead of mongodb_collectionname_watchdog in the first version and mongodb_collectionname in the latest release).
Comment #2
thebuckst0p commentedComment #3
thebuckst0p commentedIn fact, the other settings - mongodb_watchdog_connection and mongodb_watchdog_dbname - are never used, so they should just be removed... the
mongodb_collection()doesn't allow for a different connection per collection anyway. Maybe this is a bigger issue (of this module suite's architecture generally) than just the variable names.Comment #4
chx commentedThese variables should simply be yanked. These were added before there was proper connection handling and there is no point IMO. Just point your collections to separate databases as needed.
Comment #5
thebuckst0p commentedThis patch removes the unused
mongodb_watchdog_connectionandmongodb_watchdog_dbnamevariables (putting here for reference). I had already removed them in my own production copy, so I committed it to 6.x-1.x (36888c0beed).The inconsistent use of collection variables is separate, though -- I need to look at this again to remember the details.
Comment #6
thebuckst0p commentedThe original issue of inconsistent variable names still exists, and is still a serious bug in the 6.x module. I've re-rolled the patch from #1 with the latest sha's. Can someone confirm that it's ok, and I'll commit it?
Comment #7
chx commentedshoudl be
Just remove them.
Comment #8
thebuckst0p commentedHmm. I don't understand how to "just point your collections to separate databases as needed" - how is this done, with single connection and dbname variables?
Also the collection is analogous to a MySql table, why would you want 'mongodb_' in the name? That would be like calling every table mysql_TABLE. What am I not understanding?
Thanks
Comment #9
chx commentedYeah, call it watchdog, sorry, that was a typo. With a single collection / dbname you can't -- just add another database to the config. They are autocreated anyways. Why would you want to name your collections something else? What is the use case? Multisite with a shared mongodb ...? I can't imagine anyone running a shared mongodb due to the single writer thread issue.
Comment #10
chx commentedSorry, crosspost.
Comment #11
chx commentedAnd now a real title.
Comment #12
thebuckst0p commentedGotcha, that makes sense.
That would leave nothing in the settings form at admin/reports/settings/mongodb, what do you suggest doing with that? (I'm thinking putting a "No settings yet" message, since it's conceivable it might be needed later. I have code elsewhere that controls the # of days to store logs, for instance (which I should post & commit separately).
Comment #13
thebuckst0p commentedSee attached patch, how does that look?
Comment #14
chx commentedCare to nuke from the other modules as well? Edit: i will follow suit in 7.x
Comment #15
thebuckst0p commentedNow also includes the 'session' collection name which I missed earlier.
Comment #16
thebuckst0p commentedCommitted to 6.x.
Comment #17
thebuckst0p commented