This is my favorite feature from db-charmer that is missing in octopus. When a query happens on a DB other than master, the debug log contains a prefix in dark blue that tells me which DB was used. The relevant function is here:
It would be wonderful if octopus also did this.
Note: I am using octopus with 0.3.4 with Rails 2.3.12.
+1. It doesn't look like 0.4.0 is compatible with rails2.x as the gemspec states that it requires active_record "= 3.0.6". I think the fix requires two changes. 1) The latest version of Octopus should run with 2.x. It appears master already has done this, so awesome. 2) The logger needs to be ported to work with ActiveRecord 2.x using the api stated in the premier comment. Anyway yo thanks.
Hi @kylev and @growlypants,
Octopus already has a logger (https://github.com/tchandy/octopus/wiki/Logger). but I personally think that it should to be improved, I prefer the log formatting from db-charmer.
Also, @growlypants, Octopus should be compatible with Rails 2.x. maybe the gemspec is wrong.
Also, patches are welcome for both of cases.
@tchandy thank you for you kind response. I always appreciate thankful messages. I believe the gemspec is wrong on version 0.4.0 (https://github.com/tchandy/octopus/blob/v0.4.0/ar-octopus.gemspec). It states s.add_runtime_dependency(%q, ["= 3.0.6"]) which requires rails 3. I'll continue look into the logger, but I can't fully investigate until we're on rails 3.
@tchandy this is the commit which removes the hard dependency on ar 3: e8114af and a new gem version has not been published with that gemspec.
The db-charmer guy has updated his idiom for shard/slave identification in rails3 land. It might be super-easy to implement now.
This is already implemented on octopus master, i.e.:
[Shard: canada] (0.3ms) SELECT COUNT(*) FROM `orders` WHERE `orders`.`account_id` = 1
I'm going to close this issue ;)