brokercap/Bifrost

[mysql binlog-subscribe]mysql not support 'insert ignore into table_xxx' and 'insert table_xxx'

cherishman2005 opened this issue · 0 comments

Version:

  • Bifrost Version: [v1.8.8-release and master branch]

Describe the bug

bug file is https://github.com/brokercap/Bifrost/blob/master/Bristol/mysql/binlog_query.go

	// UPDATE Table
	// INSERT INTO Table
	// DELETE FROM Table
	// REPLACE INTO Table
	var tableNameIndex = 0
	if len(sqlUpper) < 6 {
		return
	}
	switch sqlUpper[0:6] {
	case "UPDATE":
		tableNameIndex = 1
		isDDL = false
		break
	case "INSERT","DELETE","REPLAC":
		tableNameIndex = 2
		isDDL = false
		break
	default:
		return
	}

To Reproduce

  • [case 1]
insert ignore into table_xxx values(...)

parse result: table is into . -- it is error, and not expected!

  • [case 2]
insert table_xxx values(...)

parse result: table is values. -- it is error, and not expected!

Screenshots

image

image

Additional context

binlog_format=STATEMENT