mysql_isolated_server 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67d72229d0517a98714dfc5deed145686d15615b
4
- data.tar.gz: cdbcf4df767a442c2966f3bbca80c744d9faa8d2
3
+ metadata.gz: f9acbc0a32698fe44576124a013b2b4ec48f2e51
4
+ data.tar.gz: 912fbacd2e4889ca24a4d741cbece22eb9c26d33
5
5
  SHA512:
6
- metadata.gz: 5b93073f78435f66251c6798c7ff04ad48c9ff88eed4b68e72d615499470793dfc29b111cf800cd69203b44b5ae1f2888d5b321b3b68496437d5bd351f3536cc
7
- data.tar.gz: 68d52352a2b3dc84306eece440380dc71ea8f4e616dd3b25bd50a27abe1c26a047f4bde3ed1aa1322e3614f981313ac7e6b73b2c92f3117ffc271bc41ef049cd
6
+ metadata.gz: d62d19dee9fdb8e18542e451fcbd3bfea8681c1cdf2b42092494392ccdfc3003bf66ccdfd3b36d1ef7652d217d9cb4676a1279da19982c4f414820c0c638d74f
7
+ data.tar.gz: a27123fa090336202e5949f08151ba72c96cf2a1a3ecd471aa91bfb7d923758e3e9c0755943925824e6edcc0c6e52e01051254f8d5fb97f52bdf0ad321d39f67
@@ -9,7 +9,7 @@ end
9
9
 
10
10
  class MysqlIsolatedServer
11
11
  include DBConnection
12
- attr_reader :pid, :base, :port
12
+ attr_reader :pid, :base, :port, :initial_binlog_file, :initial_binlog_pos
13
13
  attr_accessor :params
14
14
  MYSQL_BASE_DIR="/usr"
15
15
 
@@ -56,13 +56,15 @@ class MysqlIsolatedServer
56
56
  end
57
57
 
58
58
  def make_slave_of(master)
59
- master_binlog_info = master.connection.query("show master status").first
59
+ binlog_file = master.initial_binlog_file || (@log_bin.split('/').last + ".000001")
60
+ binlog_pos = master.initial_binlog_pos || 106
61
+
60
62
  connection.query(<<-EOL
61
63
  change master to master_host='127.0.0.1',
62
64
  master_port=#{master.port},
63
65
  master_user='root', master_password='',
64
- master_log_file='#{master_binlog_info['File']}',
65
- master_log_pos=#{master_binlog_info['Position']}
66
+ master_log_file='#{binlog_file}',
67
+ master_log_pos=#{binlog_pos}
66
68
  EOL
67
69
  )
68
70
  connection.query("SLAVE START")
@@ -133,6 +135,9 @@ class MysqlIsolatedServer
133
135
 
134
136
  up!
135
137
 
138
+ master_binlog_info = connection.query("show master status").first
139
+ @initial_binlog_file, @initial_binlog_pos = master_binlog_info.values_at('File', 'Position')
140
+
136
141
  tzinfo_to_sql = locate_executable("mysql_tzinfo_to_sql5", "mysql_tzinfo_to_sql")
137
142
  raise "could not find mysql_tzinfo_to_sql" unless tzinfo_to_sql
138
143
  system("#{tzinfo_to_sql} /usr/share/zoneinfo 2>/dev/null| mysql -h127.0.0.1 --database=mysql --port=#{@port} -u root mysql ")
@@ -1,3 +1,3 @@
1
1
  class MysqlIsolatedServer
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_isolated_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Osheroff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-11 00:00:00.000000000 Z
11
+ date: 2014-08-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A small library that allows you to easily spin up new local mysql servers
14
14
  for testing purposes.