Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Preventing Duplicate Migrations on the Same Shard #580

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update migration.rb
use unique shards for Octopus::Migrator#send_queries_to_multiple_shards
  • Loading branch information
prathamesh-vic authored Aug 18, 2023
commit a31b1c019ae6cffa349153e6f1fb1a67d66cce47
4 changes: 2 additions & 2 deletions lib/octopus/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class << self

def run_with_octopus(&block)
return run_without_octopus(&block) unless connection.is_a?(Octopus::Proxy)
shards = migrations.map(&:shards).flatten.map(&:to_s)
shards = migrations.map(&:shards).flatten.map(&:to_s).uniq
connection.send_queries_to_multiple_shards(shards) do
run_without_octopus(&block)
end
Expand All @@ -109,7 +109,7 @@ def run_with_octopus(&block)

def migrate_with_octopus(&block)
return migrate_without_octopus(&block) unless connection.is_a?(Octopus::Proxy)
shards = migrations.map(&:shards).flatten.map(&:to_s)
shards = migrations.map(&:shards).flatten.map(&:to_s).uniq
connection.send_queries_to_multiple_shards(shards) do
migrate_without_octopus(&block)
end
Expand Down