MCPcopy Create free account
hub / github.com/actiontech/dtle / checkDtleQueryOSID

Method checkDtleQueryOSID

driver/mysql/binlog/binlog_reader.go:759–790  ·  view source on GitHub ↗
(query string)

Source from the content-addressed store, hash-verified

757)
758
759func (b *BinlogReader) checkDtleQueryOSID(query string) error {
760
761 start := strings.Index(query, dtleQueryPrefix)
762 if start == -1 {
763 return nil
764 }
765 start += len(dtleQueryPrefix)
766
767 end := strings.Index(query, dtleQuerySuffix)
768 if end == -1 {
769 return fmt.Errorf("incomplete dtle_gtid for query %v", query)
770 }
771 if end < start {
772 return fmt.Errorf("bad dtle_gtid for query %v", query)
773 }
774
775 dtleItem := query[start:end]
776 ss := strings.Split(dtleItem, " ")
777 if len(ss) != 3 {
778 return fmt.Errorf("bad dtle_gtid splitted for query %v", query)
779 }
780
781 b.logger.Debug("query osid", "osid", ss[1], "gno", b.entryContext.Entry.Coordinates.GetGNO())
782
783 sid, err := uuid.FromString(ss[1])
784 if err != nil {
785 return err
786 }
787
788 b.entryContext.Entry.Coordinates.(*common.MySQLCoordinateTx).SID = sid
789 return nil
790}
791func (b *BinlogReader) setDtleQuery(query string) string {
792 if strings.Contains(query, "/*dtle_gtid1") {
793 return query

Callers 1

handleQueryEventMethod · 0.95

Calls 1

GetGNOMethod · 0.65

Tested by

no test coverage detected