Java Code Examples for com.taobao.tddl.dbsync.binlog.event.RowsLogEvent#getColumns()
The following examples show how to use
com.taobao.tddl.dbsync.binlog.event.RowsLogEvent#getColumns() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MysqlBinlogParsePerformanceTest.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
public static void parseRowsEvent(RowsLogEvent event, AtomicLong sum) { try { RowsLogBuffer buffer = event.getRowsBuf(charset.name()); BitSet columns = event.getColumns(); BitSet changeColumns = event.getChangeColumns(); while (buffer.nextOneRow(columns)) { int type = event.getHeader().getType(); if (LogEvent.WRITE_ROWS_EVENT_V1 == type || LogEvent.WRITE_ROWS_EVENT == type) { parseOneRow(event, buffer, columns, true); } else if (LogEvent.DELETE_ROWS_EVENT_V1 == type || LogEvent.DELETE_ROWS_EVENT == type) { parseOneRow(event, buffer, columns, false); } else { parseOneRow(event, buffer, columns, false); if (!buffer.nextOneRow(changeColumns, true)) { break; } parseOneRow(event, buffer, changeColumns, true); } sum.incrementAndGet(); } } catch (Exception e) { throw new RuntimeException("parse row data failed.", e); } }
Example 2
Source File: MysqlBinlogParsePerformanceTest.java From canal with Apache License 2.0 | 6 votes |
public static void parseRowsEvent(RowsLogEvent event, AtomicLong sum) { try { RowsLogBuffer buffer = event.getRowsBuf(charset.name()); BitSet columns = event.getColumns(); BitSet changeColumns = event.getChangeColumns(); while (buffer.nextOneRow(columns)) { int type = event.getHeader().getType(); if (LogEvent.WRITE_ROWS_EVENT_V1 == type || LogEvent.WRITE_ROWS_EVENT == type) { parseOneRow(event, buffer, columns, true); } else if (LogEvent.DELETE_ROWS_EVENT_V1 == type || LogEvent.DELETE_ROWS_EVENT == type) { parseOneRow(event, buffer, columns, false); } else { parseOneRow(event, buffer, columns, false); if (!buffer.nextOneRow(changeColumns, true)) { break; } parseOneRow(event, buffer, changeColumns, true); } sum.incrementAndGet(); } } catch (Exception e) { throw new RuntimeException("parse row data failed.", e); } }
Example 3
Source File: BaseLogFetcherTest.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
protected void parseRowsEvent(RowsLogEvent event) { try { System.out.println(String.format("================> binlog[%s:%s] , name[%s,%s]", binlogFileName, event.getHeader().getLogPos() - event.getHeader().getEventLen(), event.getTable().getDbName(), event.getTable().getTableName())); RowsLogBuffer buffer = event.getRowsBuf(charset.name()); BitSet columns = event.getColumns(); BitSet changeColumns = event.getChangeColumns(); while (buffer.nextOneRow(columns)) { // 处理row记录 int type = event.getHeader().getType(); if (LogEvent.WRITE_ROWS_EVENT_V1 == type || LogEvent.WRITE_ROWS_EVENT == type) { // insert的记录放在before字段中 parseOneRow(event, buffer, columns, true); } else if (LogEvent.DELETE_ROWS_EVENT_V1 == type || LogEvent.DELETE_ROWS_EVENT == type) { // delete的记录放在before字段中 parseOneRow(event, buffer, columns, false); } else { // update需要处理before/after System.out.println("-------> before"); parseOneRow(event, buffer, columns, false); if (!buffer.nextOneRow(changeColumns, true)) { break; } System.out.println("-------> after"); parseOneRow(event, buffer, changeColumns, true); } } } catch (Exception e) { throw new RuntimeException("parse row data failed.", e); } }
Example 4
Source File: DirectLogFetcherTest.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
protected void parseRowsEvent(RowsLogEvent event) { try { System.out.println(String.format("================> binlog[%s:%s] , name[%s,%s]", binlogFileName, event.getHeader().getLogPos() - event.getHeader().getEventLen(), event.getTable().getDbName(), event.getTable().getTableName())); RowsLogBuffer buffer = event.getRowsBuf(charset.name()); BitSet columns = event.getColumns(); BitSet changeColumns = event.getChangeColumns(); while (buffer.nextOneRow(columns)) { // 处理row记录 int type = event.getHeader().getType(); if (LogEvent.WRITE_ROWS_EVENT_V1 == type || LogEvent.WRITE_ROWS_EVENT == type) { // insert的记录放在before字段中 parseOneRow(event, buffer, columns, true); } else if (LogEvent.DELETE_ROWS_EVENT_V1 == type || LogEvent.DELETE_ROWS_EVENT == type) { // delete的记录放在before字段中 parseOneRow(event, buffer, columns, false); } else { // update需要处理before/after System.out.println("-------> before"); parseOneRow(event, buffer, columns, false); if (!buffer.nextOneRow(changeColumns, true)) { break; } System.out.println("-------> after"); parseOneRow(event, buffer, changeColumns, true); } } } catch (Exception e) { throw new RuntimeException("parse row data failed.", e); } }
Example 5
Source File: BaseLogFetcherTest.java From canal with Apache License 2.0 | 5 votes |
protected void parseRowsEvent(RowsLogEvent event) { try { System.out.println(String.format("================> binlog[%s:%s] , name[%s,%s]", binlogFileName, event.getHeader().getLogPos() - event.getHeader().getEventLen(), event.getTable().getDbName(), event.getTable().getTableName())); RowsLogBuffer buffer = event.getRowsBuf(charset.name()); BitSet columns = event.getColumns(); BitSet changeColumns = event.getChangeColumns(); while (buffer.nextOneRow(columns)) { // 处理row记录 int type = event.getHeader().getType(); if (LogEvent.WRITE_ROWS_EVENT_V1 == type || LogEvent.WRITE_ROWS_EVENT == type) { // insert的记录放在before字段中 parseOneRow(event, buffer, columns, true); } else if (LogEvent.DELETE_ROWS_EVENT_V1 == type || LogEvent.DELETE_ROWS_EVENT == type) { // delete的记录放在before字段中 parseOneRow(event, buffer, columns, false); } else { // update需要处理before/after System.out.println("-------> before"); parseOneRow(event, buffer, columns, false); if (!buffer.nextOneRow(changeColumns, true)) { break; } System.out.println("-------> after"); parseOneRow(event, buffer, changeColumns, true); } } } catch (Exception e) { throw new RuntimeException("parse row data failed.", e); } }
Example 6
Source File: DirectLogFetcherTest.java From canal with Apache License 2.0 | 5 votes |
protected void parseRowsEvent(RowsLogEvent event) { try { System.out.println(String.format("================> binlog[%s:%s] , name[%s,%s]", binlogFileName, event.getHeader().getLogPos() - event.getHeader().getEventLen(), event.getTable().getDbName(), event.getTable().getTableName())); RowsLogBuffer buffer = event.getRowsBuf(charset.name()); BitSet columns = event.getColumns(); BitSet changeColumns = event.getChangeColumns(); while (buffer.nextOneRow(columns)) { // 处理row记录 int type = event.getHeader().getType(); if (LogEvent.WRITE_ROWS_EVENT_V1 == type || LogEvent.WRITE_ROWS_EVENT == type) { // insert的记录放在before字段中 parseOneRow(event, buffer, columns, true); } else if (LogEvent.DELETE_ROWS_EVENT_V1 == type || LogEvent.DELETE_ROWS_EVENT == type) { // delete的记录放在before字段中 parseOneRow(event, buffer, columns, false); } else { // update需要处理before/after System.out.println("-------> before"); parseOneRow(event, buffer, columns, false); if (!buffer.nextOneRow(changeColumns, true)) { break; } System.out.println("-------> after"); parseOneRow(event, buffer, changeColumns, true); } } } catch (Exception e) { throw new RuntimeException("parse row data failed.", e); } }