octopus icon indicating copy to clipboard operation
octopus copied to clipboard

Fully replicated isn't sending all reads to slave

Open drewB opened this issue 8 years ago • 7 comments

I have octopus setup for full replication. I can see that some read requests are going to the slave but not others. I know this by looking at the logs and seeing when there is a shard message or not. Also I can see by the traffic to the slave. Am I mistaken in thinking that ALL read requests should go to the slave? I also saw https://github.com/thiagopradi/octopus/issues/377 so rolled back to 0.8.5 but see the same issue.

Here is my shards.yml:

octopus:
 replicated: true
 environments:
   - staging
 staging:
   slave1:
     adapter: mysql2
     host: <%= ENV['SLAVE1_DATABASE_HOST'] %>
     password: <%= ENV['DB_PASSWORD'] %>
     pool: <%= ENV['APP_POOL_SIZE'] %>
     database: my_db_name
     reconnect: true

drewB avatar Jul 01 '17 02:07 drewB

same issue here. When I do User.using(:slave1).count the query goes to slave, but when I do User.count the query goes to master. Also I'm using fully_replicated: true as well

luizkowalski avatar Jul 05 '17 11:07 luizkowalski

HI @drewB and @luizkowalski - can you try to use Octopus from git, using branch fixing_replication_bug_new? Please note that this is an experimental fix, so don't deploy this branch to production in any case - the patch with the fix needs to be polished.

Thiago

thiagopradi avatar Jul 18 '17 03:07 thiagopradi

I forgot to post here, I fixed the issue just changing my yaml file. it was wrong and someone point that to me

luizkowalski avatar Jul 18 '17 08:07 luizkowalski

I just tried the new branch but it is not compatible with Rails 3.2 which is what I am running.

drewB avatar Jul 18 '17 15:07 drewB

Just noticed that 0.6.1 is the last version that supports Rails 3.2. Strange the new version did work for me. I am going to try with 0.6.1 and see if that fixes the problem.

drewB avatar Jul 18 '17 15:07 drewB

Oh wait. That is the last version that supports Rails 3.0. So later versions should be fine with Rails 3.2.

drewB avatar Jul 18 '17 15:07 drewB

Just to try I went back to 0.6.1 and that seemed to fix the issue. With 0.7.0 the issue returned.

drewB avatar Jul 19 '17 01:07 drewB