资源描述:
《MySQL binlog中事件类型详解》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、MySQLbinlog中的事件类型详解MySQLbinlog记录的所有操作实际上都有对应的事件类型的,譬如STATEMENT格式中的DML操作对应的是QUERY_EVENT类型,ROW格式下的DML操作对应的是ROWS_EVENT类型。首先,看看源码中定义的事件类型源码位置:mysql-5.7.14/libbinlogevents/include/binlog_event.h?123456789101112131415161718192021222324252627282930313233343536373839404142434445
2、464748495051525354555657585960616263646566676869707172737475767778enumLog_event_type{/**Everytimeyouupdatethisenum(whenyouaddatype),youhavetofixFormat_description_event::Format_description_event().*/UNKNOWN_EVENT=0,START_EVENT_V3=1,QUERY_EVENT=2,STOP_EVENT=3,ROTATE_EVENT
3、=4,INTVAR_EVENT=5,LOAD_EVENT=6,SLAVE_EVENT=7,CREATE_FILE_EVENT=8,APPEND_BLOCK_EVENT=9,EXEC_LOAD_EVENT=10,DELETE_FILE_EVENT=11,/**NEW_LOAD_EVENTislikeLOAD_EVENTexceptthatithasalongersql_ex,allowingmultibyteTERMINATEDBYetc;bothtypessharethesameclass(Load_event)*/NEW_LOAD_E
4、VENT=12,RAND_EVENT=13,USER_VAR_EVENT=14,FORMAT_DESCRIPTION_EVENT=15,XID_EVENT=16,BEGIN_LOAD_QUERY_EVENT=17,EXECUTE_LOAD_QUERY_EVENT=18,TABLE_MAP_EVENT=19,/**ThePRE_GAeventnumberswereusedfor5.1.0to5.1.15andarethereforeobsolete.*/PRE_GA_WRITE_ROWS_EVENT=20,PRE_GA_UPDATE_RO
5、WS_EVENT=21,PRE_GA_DELETE_ROWS_EVENT=22,/**TheV1eventnumbersareusedfrom5.1.16untilmysql-trunk-xx*/WRITE_ROWS_EVENT_V1=23,UPDATE_ROWS_EVENT_V1=24,DELETE_ROWS_EVENT_V1=25,/**Somethingoutoftheordinaryhappenedonthemaster*/INCIDENT_EVENT=26,/**Heartbeateventtobesendbymasterat
6、itsidletimetoensuremaster'sonlinestatustoslave*/HEARTBEAT_LOG_EVENT=27,/**Insomesituations,itisnecessarytosendoverignorabledatatotheslave:datathataslavecanhandleincasethereiscodeforhandlingit,butwhichcanbeignoredifitisnotrecognized.*/IGNORABLE_LOG_EVENT=28,ROWS_QUERY_LOG
7、_EVENT=29,/**Version2oftheRowevents*/WRITE_ROWS_EVENT=30,UPDATE_ROWS_EVENT=31,DELETE_ROWS_EVENT=32,GTID_LOG_EVENT=33,ANONYMOUS_GTID_LOG_EVENT=34,PREVIOUS_GTIDS_LOG_EVENT=35,TRANSACTION_CONTEXT_EVENT=36,VIEW_CHANGE_EVENT=37,/*PreparedXAtransactionterminaleventsimilartoXid
8、*/XA_PREPARE_LOG_EVENT=38,/**Addneweventshere-rightabovethiscomment!Existingevents(exceptENUM_END_EVENT