Skip to content

Commit cf950f8

Browse files
committed
current changes
1 parent 3f41237 commit cf950f8

File tree

3 files changed

+90
-74
lines changed

3 files changed

+90
-74
lines changed

README.md

Lines changed: 80 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Available options:
8686

8787
'tableCacheSize' - some data are collected from information schema, this data is cached. This variable set cache for tables bigger takes more memory. (default 128 objects)
8888

89+
'custom' - if some params must be set in extended/implemented own classes
8990

9091
Examples
9192
=========
@@ -113,73 +114,79 @@ UPDATE test4 SET data = "World", data2="Hello" WHERE id = 1;
113114
DELETE FROM test4 WHERE id = 1;
114115
```
115116

116-
Output will be similar to this (depends on configuration):
117+
Output will be similar to this (depends on configuration for example GTID off/on):
117118

119+
=== Event format description ===
120+
Date: 2017-07-06T13:31:11+00:00
121+
Log position: 0
122+
Event size: 116
123+
Memory usage 2.4 MB
124+
118125
=== Event gtid ===
119-
Date: 2016-03-13T21:46:31+00:00
120-
Log position: 4021014
126+
Date: 2017-07-06T15:23:44+00:00
127+
Log position: 57803092
121128
Event size: 48
122129
Commit: true
123-
GTID NEXT: 9b1c8d18-2a76-11e5-a26b-000c2976f3f3:160837
124-
Memory usage 2.36 MB
130+
GTID NEXT: 3403c535-624f-11e7-9940-0800275713ee:13675
131+
Memory usage 2.42 MB
125132

126133
=== Event query ===
127-
Date: 2016-03-13T21:46:31+00:00
128-
Log position: 4021159
134+
Date: 2017-07-06T15:23:44+00:00
135+
Log position: 57803237
129136
Event size: 145
130137
Database: php_mysql_replication
131138
Execution time: 0
132139
Query: CREATE DATABASE php_mysql_replication
133-
Memory usage 2.36 MB
140+
Memory usage 2.45 MB
134141

135142
=== Event gtid ===
136-
Date: 2016-03-13T21:46:31+00:00
137-
Log position: 4021207
143+
Date: 2017-07-06T15:23:44+00:00
144+
Log position: 57803285
138145
Event size: 48
139146
Commit: true
140-
GTID NEXT: 9b1c8d18-2a76-11e5-a26b-000c2976f3f3:160838
141-
Memory usage 2.36 MB
147+
GTID NEXT: 3403c535-624f-11e7-9940-0800275713ee:13676
148+
Memory usage 2.45 MB
142149

143150
=== Event query ===
144-
Date: 2016-03-13T21:46:31+00:00
145-
Log position: 4021422
151+
Date: 2017-07-06T15:23:44+00:00
152+
Log position: 57803500
146153
Event size: 215
147154
Database: php_mysql_replication
148155
Execution time: 0
149156
Query: CREATE TABLE test4 (id int NOT NULL AUTO_INCREMENT, data VARCHAR(255), data2 VARCHAR(255), PRIMARY KEY(id))
150-
Memory usage 2.36 MB
157+
Memory usage 2.45 MB
151158

152159
=== Event gtid ===
153-
Date: 2016-03-13T21:46:31+00:00
154-
Log position: 4021470
160+
Date: 2017-07-06T15:23:44+00:00
161+
Log position: 57803548
155162
Event size: 48
156163
Commit: true
157-
GTID NEXT: 9b1c8d18-2a76-11e5-a26b-000c2976f3f3:160839
158-
Memory usage 2.36 MB
164+
GTID NEXT: 3403c535-624f-11e7-9940-0800275713ee:13677
165+
Memory usage 2.45 MB
159166

160167
=== Event query ===
161-
Date: 2016-03-13T21:46:31+00:00
162-
Log position: 4021559
168+
Date: 2017-07-06T15:23:44+00:00
169+
Log position: 57803637
163170
Event size: 89
164171
Database: php_mysql_replication
165172
Execution time: 0
166173
Query: BEGIN
167-
Memory usage 2.36 MB
174+
Memory usage 2.45 MB
168175

169176
=== Event tableMap ===
170-
Date: 2016-03-13T21:46:31+00:00
171-
Log position: 4021630
177+
Date: 2017-07-06T15:23:44+00:00
178+
Log position: 57803708
172179
Event size: 71
173180
Table: test4
174181
Database: php_mysql_replication
175-
Table Id: 1135
182+
Table Id: 866
176183
Columns amount: 3
177-
Memory usage 2.36 MB
184+
Memory usage 2.71 MB
178185

179186
=== Event write ===
180-
Date: 2016-03-13T21:46:31+00:00
181-
Log position: 4021682
182-
Event size: 52
187+
Date: 2017-07-06T15:23:44+00:00
188+
Log position: 57803762
189+
Event size: 54
183190
Table: test4
184191
Affected columns: 3
185192
Changed rows: 1
@@ -194,46 +201,46 @@ Output will be similar to this (depends on configuration):
194201

195202
)
196203

197-
Memory usage 2.37 MB
204+
Memory usage 2.74 MB
198205

199206
=== Event xid ===
200-
Date: 2016-03-13T21:46:31+00:00
201-
Log position: 4021713
207+
Date: 2017-07-06T15:23:44+00:00
208+
Log position: 57803793
202209
Event size: 31
203-
Transaction ID: 252191
204-
Memory usage 2.37 MB
210+
Transaction ID: 662802
211+
Memory usage 2.75 MB
205212

206213
=== Event gtid ===
207-
Date: 2016-03-13T21:46:31+00:00
208-
Log position: 4021761
214+
Date: 2017-07-06T15:23:44+00:00
215+
Log position: 57803841
209216
Event size: 48
210217
Commit: true
211-
GTID NEXT: 9b1c8d18-2a76-11e5-a26b-000c2976f3f3:160840
212-
Memory usage 2.37 MB
218+
GTID NEXT: 3403c535-624f-11e7-9940-0800275713ee:13678
219+
Memory usage 2.75 MB
213220

214221
=== Event query ===
215-
Date: 2016-03-13T21:46:31+00:00
216-
Log position: 4021850
222+
Date: 2017-07-06T15:23:44+00:00
223+
Log position: 57803930
217224
Event size: 89
218225
Database: php_mysql_replication
219226
Execution time: 0
220227
Query: BEGIN
221-
Memory usage 2.37 MB
228+
Memory usage 2.76 MB
222229

223230
=== Event tableMap ===
224-
Date: 2016-03-13T21:46:31+00:00
225-
Log position: 4021921
231+
Date: 2017-07-06T15:23:44+00:00
232+
Log position: 57804001
226233
Event size: 71
227234
Table: test4
228235
Database: php_mysql_replication
229-
Table Id: 1135
236+
Table Id: 866
230237
Columns amount: 3
231-
Memory usage 2.37 MB
238+
Memory usage 2.75 MB
232239

233240
=== Event update ===
234-
Date: 2016-03-13T21:46:31+00:00
235-
Log position: 4021991
236-
Event size: 70
241+
Date: 2017-07-06T15:23:44+00:00
242+
Log position: 57804075
243+
Event size: 74
237244
Table: test4
238245
Affected columns: 3
239246
Changed rows: 1
@@ -259,46 +266,46 @@ Output will be similar to this (depends on configuration):
259266

260267
)
261268

262-
Memory usage 2.37 MB
269+
Memory usage 2.76 MB
263270

264271
=== Event xid ===
265-
Date: 2016-03-13T21:46:31+00:00
266-
Log position: 4022022
272+
Date: 2017-07-06T15:23:44+00:00
273+
Log position: 57804106
267274
Event size: 31
268-
Transaction ID: 252196
269-
Memory usage 2.37 MB
275+
Transaction ID: 662803
276+
Memory usage 2.76 MB
270277

271278
=== Event gtid ===
272-
Date: 2016-03-13T21:46:31+00:00
273-
Log position: 4022070
279+
Date: 2017-07-06T15:23:44+00:00
280+
Log position: 57804154
274281
Event size: 48
275282
Commit: true
276-
GTID NEXT: 9b1c8d18-2a76-11e5-a26b-000c2976f3f3:160841
277-
Memory usage 2.37 MB
283+
GTID NEXT: 3403c535-624f-11e7-9940-0800275713ee:13679
284+
Memory usage 2.76 MB
278285

279286
=== Event query ===
280-
Date: 2016-03-13T21:46:31+00:00
281-
Log position: 4022159
287+
Date: 2017-07-06T15:23:44+00:00
288+
Log position: 57804243
282289
Event size: 89
283290
Database: php_mysql_replication
284291
Execution time: 0
285292
Query: BEGIN
286-
Memory usage 2.37 MB
293+
Memory usage 2.76 MB
287294

288295
=== Event tableMap ===
289-
Date: 2016-03-13T21:46:31+00:00
290-
Log position: 4022230
296+
Date: 2017-07-06T15:23:44+00:00
297+
Log position: 57804314
291298
Event size: 71
292299
Table: test4
293300
Database: php_mysql_replication
294-
Table Id: 1135
301+
Table Id: 866
295302
Columns amount: 3
296-
Memory usage 2.37 MB
303+
Memory usage 2.76 MB
297304

298305
=== Event delete ===
299-
Date: 2016-03-13T21:46:31+00:00
300-
Log position: 4022282
301-
Event size: 52
306+
Date: 2017-07-06T15:23:44+00:00
307+
Log position: 57804368
308+
Event size: 54
302309
Table: test4
303310
Affected columns: 3
304311
Changed rows: 1
@@ -313,14 +320,15 @@ Output will be similar to this (depends on configuration):
313320

314321
)
315322

316-
Memory usage 2.38 MB
323+
Memory usage 2.77 MB
317324

318325
=== Event xid ===
319-
Date: 2016-03-13T21:46:31+00:00
320-
Log position: 4022313
326+
Date: 2017-07-06T15:23:44+00:00
327+
Log position: 57804399
321328
Event size: 31
322-
Transaction ID: 252199
323-
Memory usage 2.38 MB
329+
Transaction ID: 662804
330+
Memory usage 2.77 MB
331+
324332

325333

326334
Benchmarks

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"type": "library",
1111
"require": {
1212
"php": ">=5.5.9",
13+
"ext-sockets": "*",
1314
"doctrine/dbal": "^2.5",
1415
"doctrine/collections": "^1.3",
15-
"ext-sockets": "*",
1616
"symfony/event-dispatcher": ">=2.8 ^3.1",
1717
"symfony/dependency-injection": ">=2.8 ^3.1",
1818
"psr/simple-cache": "^1.0"
@@ -32,5 +32,10 @@
3232
"MySQLReplication\\": "src/MySQLReplication/"
3333
}
3434
},
35+
"autoload-dev": {
36+
"psr-4": {
37+
"MySQLReplication\\Tests\\": "tests/"
38+
}
39+
},
3540
"minimum-stability": "stable"
3641
}

example/dump_events.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use MySQLReplication\Event\EventSubscribers;
1212
use MySQLReplication\MySQLReplicationFactory;
1313

14+
/**
15+
* Your db configuration @see ConfigBuilder for more options
16+
*/
1417
$binLogStream = new MySQLReplicationFactory(
1518
(new ConfigBuilder())
1619
->withUser('root')
@@ -34,7 +37,7 @@ public function allEvents(EventDTO $event)
3437
echo $event;
3538

3639
// all events got JsonSerializable implementation
37-
echo json_encode($event, JSON_PRETTY_PRINT);
40+
//echo json_encode($event, JSON_PRETTY_PRINT);
3841

3942
echo 'Memory usage ' . round(memory_get_usage() / 1048576, 2) . ' MB' . PHP_EOL;
4043
}

0 commit comments

Comments
 (0)