Sha256: f8aef2a2928e632810680e98dca6114fb47738b442a90128a7ac02e211529739

Contents?: true

Size: 1.02 KB

Versions: 14

Compression:

Stored size: 1.02 KB

Contents

require 'bundler/setup'
require 'mysql2'
require_relative '../boot_mysql_env'
master_cut_script = File.expand_path(File.dirname(__FILE__)) + "/../../bin/master_cut"

puts "testing with long running queries..."

$mysql_master.connection.query("set GLOBAL READ_ONLY=0")
$mysql_slave.connection.query("set GLOBAL READ_ONLY=1")
$mysql_master.connection.send(:reconnect=, true)
$mysql_slave.connection.send(:reconnect=, true)

thread = Thread.new {
  begin
    $mysql_master.connection.query("update flexmaster_test.users set name=sleep(600)")
    puts "Query did not get killed!  Bad."
    exit 1
  rescue Exception => e
    puts e
  end
}

system "#{master_cut_script} 127.0.0.1:#{$mysql_master.port} 127.0.0.1:#{$mysql_slave.port} root -p ''"

thread.join

if $mysql_master.connection.query("select @@read_only as ro").first['ro'] != 1
  puts "Master is not readonly!"
  exit 1
end

if $mysql_slave.connection.query("select @@read_only as ro").first['ro'] != 0
  puts "Slave is not readwrite!"
  exit 1
end

puts "everything seemed to go ok..."

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ar_mysql_flexmaster-0.4.4 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.4.3 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.4.2 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.4.1 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.4.0 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.3.1 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.3.0 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.2.2 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.2.1 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.2.0 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.1.3 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.1.2 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.1.1 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.1.0 test/integration/with_queries_to_be_killed_test.rb