@@ -135,6 +135,7 @@ public X509Certificate[] getAcceptedIssuers() {
135
135
private GtidSet gtidSet ;
136
136
private final Object gtidSetAccessLock = new Object ();
137
137
private boolean gtidSetFallbackToPurged ;
138
+ private boolean useBinlogFilenamePositionInGtidMode ;
138
139
private String gtid ;
139
140
private boolean tx ;
140
141
@@ -307,9 +308,7 @@ public String getGtidSet() {
307
308
* to "" (provided it's null) forcing MySQL to send events starting from the oldest known binlog (keep in mind
308
309
* that connection will fail if gtid_purged is anything but empty (unless
309
310
* {@link #setGtidSetFallbackToPurged(boolean)} is set to true))).
310
- * <p>NOTE #2: {@link #setBinlogFilename(String)} and {@link #setBinlogPosition(long)} can be used to specify the
311
- * exact position from which MySQL server should start streaming events (taking into account GTID set).
312
- * <p>NOTE #3: GTID set is automatically updated with each incoming GTID event (provided GTID mode is on).
311
+ * <p>NOTE #2: GTID set is automatically updated with each incoming GTID event (provided GTID mode is on).
313
312
* @see #getGtidSet()
314
313
* @see #setGtidSetFallbackToPurged(boolean)
315
314
*/
@@ -337,6 +336,22 @@ public void setGtidSetFallbackToPurged(boolean gtidSetFallbackToPurged) {
337
336
this .gtidSetFallbackToPurged = gtidSetFallbackToPurged ;
338
337
}
339
338
339
+ /**
340
+ * @see #setUseBinlogFilenamePositionInGtidMode(boolean)
341
+ */
342
+ public boolean isUseBinlogFilenamePositionInGtidMode () {
343
+ return useBinlogFilenamePositionInGtidMode ;
344
+ }
345
+
346
+ /**
347
+ * @param useBinlogFilenamePositionInGtidMode true if MySQL server should start streaming events from a given
348
+ * {@link #getBinlogFilename()} and {@link #getBinlogPosition()} instead of "the oldest known binlog" when
349
+ * {@link #getGtidSet()} is set, false otherwise (default).
350
+ */
351
+ public void setUseBinlogFilenamePositionInGtidMode (boolean useBinlogFilenamePositionInGtidMode ) {
352
+ this .useBinlogFilenamePositionInGtidMode = useBinlogFilenamePositionInGtidMode ;
353
+ }
354
+
340
355
/**
341
356
* @return true if "keep alive" thread should be automatically started (default), false otherwise.
342
357
* @see #setKeepAlive(boolean)
@@ -644,7 +659,10 @@ private void requestBinaryLogStream() throws IOException {
644
659
Command dumpBinaryLogCommand ;
645
660
synchronized (gtidSetAccessLock ) {
646
661
if (gtidSet != null ) {
647
- dumpBinaryLogCommand = new DumpBinaryLogGtidCommand (serverId , binlogFilename , binlogPosition , gtidSet );
662
+ dumpBinaryLogCommand = new DumpBinaryLogGtidCommand (serverId ,
663
+ useBinlogFilenamePositionInGtidMode ? binlogFilename : "" ,
664
+ useBinlogFilenamePositionInGtidMode ? binlogPosition : 4 ,
665
+ gtidSet );
648
666
} else {
649
667
dumpBinaryLogCommand = new DumpBinaryLogCommand (serverId , binlogFilename , binlogPosition );
650
668
}
0 commit comments