lhm 1.0.0.rc3 → 1.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+
2
+ # 1.0.0.rc4 (January 29, 2012)
3
+
4
+ * added '-- lhm' to the end of statements for more visibility
5
+
1
6
  # 1.0.0.rc3 (January 19, 2012)
2
7
 
3
8
  * Speedup migrations for tables with large minimum id
@@ -21,14 +21,16 @@ module Lhm
21
21
  end
22
22
 
23
23
  def sql(statements)
24
- [statements].flatten.each { |statement| connection.execute(statement) }
24
+ [statements].flatten.each do |statement|
25
+ connection.execute(tagged(statement))
26
+ end
25
27
  rescue ActiveRecord::StatementInvalid, Mysql::Error => e
26
28
  error e.message
27
29
  end
28
30
 
29
31
  def update(statements)
30
32
  [statements].flatten.inject(0) do |memo, statement|
31
- memo += connection.update(statement)
33
+ memo += connection.update(tagged(statement))
32
34
  end
33
35
  rescue ActiveRecord::StatementInvalid, Mysql::Error => e
34
36
  error e.message
@@ -36,6 +38,10 @@ module Lhm
36
38
 
37
39
  private
38
40
 
41
+ def tagged(statement)
42
+ statement + " -- lhm"
43
+ end
44
+
39
45
  def column_definition(cols)
40
46
  Array(cols).map do |column|
41
47
  column.to_s.match(/`?([^\(]+)`?(\([^\)]+\))?/).captures
@@ -2,5 +2,5 @@
2
2
  # Schmidt
3
3
 
4
4
  module Lhm
5
- VERSION = "1.0.0.rc3"
5
+ VERSION = "1.0.0.rc4"
6
6
  end
@@ -1,3 +1,4 @@
1
+ mysqldir=/usr/local/mysql
1
2
  basedir=/opt/lhm-cluster
2
3
  master_port=3306
3
4
  slave_port=3307
@@ -12,7 +12,7 @@ lhmkill() {
12
12
 
13
13
  echo stopping other running mysql instance
14
14
  launchctl remove com.mysql.mysqld || { echo launchctl did not remove mysqld; }
15
- mysqladmin shutdown || { echo mysqladmin did not shut down anything; }
15
+ "$mysqldir"/bin/mysqladmin shutdown || { echo mysqladmin did not shut down anything; }
16
16
 
17
17
  echo killing lhm-cluster
18
18
  lhmkill
@@ -24,8 +24,8 @@ echo setting up cluster
24
24
  spec/config/setup-cluster
25
25
 
26
26
  echo staring instances
27
- mysqld --defaults-file="$basedir/master/my.cnf" 2>&1 >$basedir/master/lhm.log &
28
- mysqld --defaults-file="$basedir/slave/my.cnf" 2>&1 >$basedir/slave/lhm.log &
27
+ "$mysqldir"/bin/mysqld --defaults-file="$basedir/master/my.cnf" 2>&1 >$basedir/master/lhm.log &
28
+ "$mysqldir"/bin/mysqld --defaults-file="$basedir/slave/my.cnf" 2>&1 >$basedir/slave/lhm.log &
29
29
  sleep 5
30
30
 
31
31
  echo running grants
@@ -2,8 +2,8 @@
2
2
 
3
3
  source .config
4
4
 
5
- master() { mysql --protocol=TCP -P $master_port -uroot; }
6
- slave() { mysql --protocol=TCP -P $slave_port -uroot; }
5
+ master() { "$mysqldir"/bin/mysql --protocol=TCP -P $master_port -uroot; }
6
+ slave() { "$mysqldir"/bin/mysql --protocol=TCP -P $slave_port -uroot; }
7
7
 
8
8
  # set up master
9
9
 
@@ -22,4 +22,4 @@ echo "grant all privileges on *.* to ''@'localhost'" | master
22
22
  echo "grant all privileges on *.* to ''@'localhost'" | slave
23
23
 
24
24
  echo "create database lhm" | master
25
- echo "create database lhm" | slave
25
+ echo "create database if not exists lhm" | slave
@@ -42,20 +42,24 @@ server-id = 2
42
42
 
43
43
  # replication (optional filters)
44
44
 
45
- replicate-do-table = lhm.users
46
- replicate-do-table = lhm.lhmn_users
47
- replicate-wild-do = lhm.lhma_%_users
45
+ # replicate-do-table = lhm.users
46
+ # replicate-do-table = lhm.lhmn_users
47
+ # replicate-wild-do-table = lhm.lhma_%_users
48
48
 
49
- replicate-do-table = lhm.origin
50
- replicate-do-table = lhm.lhmn_origin
51
- replicate-wild-do = lhm.lhma_%_origin
49
+ # replicate-do-table = lhm.origin
50
+ # replicate-do-table = lhm.lhmn_origin
51
+ # replicate-wild-do-table = lhm.lhma_%_origin
52
52
 
53
- replicate-do-table = lhm.destination
54
- replicate-do-table = lhm.lhmn_destination
55
- replicate-wild-do = lhm.lhma_%_destination
53
+ # replicate-do-table = lhm.destination
54
+ # replicate-do-table = lhm.lhmn_destination
55
+ # replicate-wild-do-table = lhm.lhma_%_destination
56
56
  CNF
57
57
 
58
58
  # build system tables
59
59
 
60
- mysql_install_db --datadir="$basedir/master/data"
61
- mysql_install_db --datadir="$basedir/slave/data"
60
+ (
61
+ cd "$mysqldir"
62
+ ./scripts/mysql_install_db --datadir="$basedir/master/data"
63
+ ./scripts/mysql_install_db --datadir="$basedir/slave/data"
64
+
65
+ )
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424051
5
- prerelease: 6
4
+ prerelease: true
6
5
  segments:
7
6
  - 1
8
7
  - 0
9
8
  - 0
10
- - rc
11
- - 3
12
- version: 1.0.0.rc3
9
+ - rc4
10
+ version: 1.0.0.rc4
13
11
  platform: ruby
14
12
  authors:
15
13
  - SoundCloud
@@ -20,7 +18,8 @@ autorequire:
20
18
  bindir: bin
21
19
  cert_chain: []
22
20
 
23
- date: 2012-01-19 00:00:00 Z
21
+ date: 2012-01-29 00:00:00 +01:00
22
+ default_executable:
24
23
  dependencies:
25
24
  - !ruby/object:Gem::Dependency
26
25
  name: mysql
@@ -30,7 +29,6 @@ dependencies:
30
29
  requirements:
31
30
  - - ~>
32
31
  - !ruby/object:Gem::Version
33
- hash: 45
34
32
  segments:
35
33
  - 2
36
34
  - 8
@@ -46,7 +44,6 @@ dependencies:
46
44
  requirements:
47
45
  - - "="
48
46
  - !ruby/object:Gem::Version
49
- hash: 39
50
47
  segments:
51
48
  - 2
52
49
  - 10
@@ -62,7 +59,6 @@ dependencies:
62
59
  requirements:
63
60
  - - ">="
64
61
  - !ruby/object:Gem::Version
65
- hash: 3
66
62
  segments:
67
63
  - 0
68
64
  version: "0"
@@ -76,7 +72,6 @@ dependencies:
76
72
  requirements:
77
73
  - - ">="
78
74
  - !ruby/object:Gem::Version
79
- hash: 3
80
75
  segments:
81
76
  - 0
82
77
  version: "0"
@@ -91,7 +86,6 @@ extensions: []
91
86
  extra_rdoc_files: []
92
87
 
93
88
  files:
94
- - .config
95
89
  - .gitignore
96
90
  - .travis.yml
97
91
  - CHANGELOG.md
@@ -136,6 +130,7 @@ files:
136
130
  - spec/unit/sql_helper_spec.rb
137
131
  - spec/unit/table_spec.rb
138
132
  - spec/unit/unit_helper.rb
133
+ has_rdoc: true
139
134
  homepage: http://github.com/soundcloud/large-hadron-migrator
140
135
  licenses: []
141
136
 
@@ -149,7 +144,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
144
  requirements:
150
145
  - - ">="
151
146
  - !ruby/object:Gem::Version
152
- hash: 3
153
147
  segments:
154
148
  - 0
155
149
  version: "0"
@@ -158,7 +152,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
152
  requirements:
159
153
  - - ">"
160
154
  - !ruby/object:Gem::Version
161
- hash: 25
162
155
  segments:
163
156
  - 1
164
157
  - 3
@@ -167,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
160
  requirements: []
168
161
 
169
162
  rubyforge_project:
170
- rubygems_version: 1.8.10
163
+ rubygems_version: 1.3.7
171
164
  signing_key:
172
165
  specification_version: 3
173
166
  summary: online schema changer for mysql
@@ -195,4 +188,3 @@ test_files:
195
188
  - spec/unit/sql_helper_spec.rb
196
189
  - spec/unit/table_spec.rb
197
190
  - spec/unit/unit_helper.rb
198
- has_rdoc:
data/.config DELETED
@@ -1,3 +0,0 @@
1
- basedir=/opt/lhm-cluster
2
- master_port=3306
3
- slave_port=3307