You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ import (
62
62
"github.com/go-mysql-org/go-mysql/replication"
63
63
"os"
64
64
)
65
-
// Create a binlog syncer with a unique server id, the server id must be different from other MySQL's.
65
+
// Create a binlog syncer with a unique server id, the server id must be different from other MySQL's.
66
66
// flavor is mysql or mariadb
67
67
cfg:= replication.BinlogSyncerConfig {
68
68
ServerID: 100,
@@ -137,7 +137,7 @@ Query: DROP TABLE IF EXISTS `test_replication` /* generated by server */
137
137
138
138
MariaDB 11.4+ introduced an optimization where events written through transaction or statement cache have `LogPos=0` so they can be copied directly to the binlog without computing the real end position. This optimization improves performance but makes position tracking unreliable for replication clients that need to track LogPos of events inside transactions.
139
139
140
-
To address this, a `MariaDBDynamicLogPos` configuration option is available:
140
+
To address this, a `FillZeroLogPos` configuration option is available:
// Enable dynamic LogPos calculation for MariaDB 11.4+
151
-
MariaDBDynamicLogPos: true,
151
+
FillZeroLogPos: true,
152
152
}
153
153
```
154
154
155
155
**Behavior:**
156
-
- When `MariaDBDynamicLogPos` is `true` and flavor is `mariadb`, the library automatically:
156
+
- When `FillZeroLogPos` is `true` and flavor is `mariadb`, the library automatically:
157
157
- Adds `BINLOG_SEND_ANNOTATE_ROWS_EVENT` flag to binlog dump commands. This ensures correct position tracking by making the server send `ANNOTATE_ROWS_EVENT` events which are needed for accurate position calculation.
158
-
- Calculates LogPos dynamically for events with `LogPos=0` that are not artificial.
158
+
- Calculates LogPos dynamically for events with `LogPos=0` that are not artificial.
159
159
- Only works with MariaDB flavor; has no effect with MySQL.
160
160
- Should be set to `true` if tracking of LogPos inside transactions is required.
161
161
162
162
## Canal
163
163
164
164
Canal is a package that can sync your MySQL into everywhere, like Redis, Elasticsearch.
165
165
166
-
First, canal will dump your MySQL data then sync changed data using binlog incrementally.
166
+
First, canal will dump your MySQL data then sync changed data using binlog incrementally.
167
167
168
-
You must use ROW format for binlog, full binlog row image is preferred, because we may meet some errors when primary key changed in update for minimal or noblob row image.
168
+
You must use ROW format for binlog, full binlog row image is preferred, because we may meet some errors when primary key changed in update for minimal or noblob row image.
169
169
170
170
A simple example:
171
171
@@ -214,9 +214,9 @@ You can see [go-mysql-elasticsearch](https://github.com/go-mysql-org/go-mysql-el
214
214
215
215
## Client
216
216
217
-
Client package supports a simple MySQL connection driver which you can use it to communicate with MySQL server.
217
+
Client package supports a simple MySQL connection driver which you can use it to communicate with MySQL server.
218
218
219
-
For an example see [`example_client_test.go`](client/example_client_test.go). You can run this testable example with
219
+
For an example see [`example_client_test.go`](client/example_client_test.go). You can run this testable example with
0 commit comments