com.taobao.tddl.dbsync.binlog.event.mariadb.AnnotateRowsEvent Java Examples

The following examples show how to use com.taobao.tddl.dbsync.binlog.event.mariadb.AnnotateRowsEvent. 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: LogEventConvert.java    From canal-1.1.3 with Apache License 2.0 5 votes vote down vote up
private Entry parseAnnotateRowsEvent(AnnotateRowsEvent event) {
    if (filterQueryDml) {
        return null;
    }
    // mariaDb支持,需要设置binlog_annotate_row_events=true,可详细打印原始DML语句
    String queryString = null;
    try {
        queryString = new String(event.getRowsQuery().getBytes(ISO_8859_1), charset.name());
        return buildQueryEntry(queryString, event.getHeader());
    } catch (UnsupportedEncodingException e) {
        throw new CanalParseException(e);
    }
}
 
Example #2
Source File: LogEventConvert.java    From DBus with Apache License 2.0 5 votes vote down vote up
private Entry parseAnnotateRowsEvent(AnnotateRowsEvent event) {
    if (filterQueryDml) {
        return null;
    }
    // mariaDb支持,需要设置binlog_annotate_row_events=true,可详细打印原始DML语句
    String queryString = null;
    try {
        queryString = new String(event.getRowsQuery().getBytes(ISO_8859_1), charset.name());
        return buildQueryEntry(queryString, event.getHeader());
    } catch (UnsupportedEncodingException e) {
        throw new CanalParseException(e);
    }
}
 
Example #3
Source File: LogEventConvert_old.java    From DBus with Apache License 2.0 5 votes vote down vote up
private Entry parseAnnotateRowsEvent(AnnotateRowsEvent event) {
    if (filterQueryDml) {
        return null;
    }
    // mariaDb֧�֣���Ҫ����binlog_annotate_row_events=true������ϸ��ӡԭʼDML���
    String queryString = null;
    try {
        queryString = new String(event.getRowsQuery().getBytes(ISO_8859_1), charset.name());
        return buildQueryEntry(queryString, event.getHeader());
    } catch (UnsupportedEncodingException e) {
        throw new CanalParseException(e);
    }
}
 
Example #4
Source File: LogEventConvert.java    From DBus with Apache License 2.0 5 votes vote down vote up
private Entry parseAnnotateRowsEvent(AnnotateRowsEvent event) {
    if (filterQueryDml) {
        return null;
    }
    // mariaDb支持,需要设置binlog_annotate_row_events=true,可详细打印原始DML语句
    String queryString = null;
    try {
        queryString = new String(event.getRowsQuery().getBytes(ISO_8859_1), charset.name());
        return buildQueryEntry(queryString, event.getHeader());
    } catch (UnsupportedEncodingException e) {
        throw new CanalParseException(e);
    }
}
 
Example #5
Source File: LogEventConvert.java    From canal with Apache License 2.0 5 votes vote down vote up
private Entry parseAnnotateRowsEvent(AnnotateRowsEvent event) {
    if (filterQueryDml) {
        return null;
    }
    // mariaDb支持,需要设置binlog_annotate_row_events=true,可详细打印原始DML语句
    String queryString = null;
    try {
        queryString = new String(event.getRowsQuery().getBytes(ISO_8859_1), charset.name());
        return buildQueryEntry(queryString, event.getHeader());
    } catch (UnsupportedEncodingException e) {
        throw new CanalParseException(e);
    }
}
 
Example #6
Source File: BaseLogFetcherTest.java    From canal-1.1.3 with Apache License 2.0 4 votes vote down vote up
protected void parseAnnotateRowsEvent(AnnotateRowsEvent event) throws Exception {
    System.out.println(String.format("================> binlog[%s:%s]", binlogFileName, event.getHeader()
        .getLogPos() - event.getHeader().getEventLen()));
    System.out.println("sql : " + new String(event.getRowsQuery().getBytes("ISO-8859-1"), charset.name()));
}
 
Example #7
Source File: LogEventConvert.java    From canal-1.1.3 with Apache License 2.0 4 votes vote down vote up
@Override
public Entry parse(LogEvent logEvent, boolean isSeek) throws CanalParseException {
    if (logEvent == null || logEvent instanceof UnknownLogEvent) {
        return null;
    }

    int eventType = logEvent.getHeader().getType();
    switch (eventType) {
        case LogEvent.QUERY_EVENT:
            return parseQueryEvent((QueryLogEvent) logEvent, isSeek);
        case LogEvent.XID_EVENT:
            return parseXidEvent((XidLogEvent) logEvent);
        case LogEvent.TABLE_MAP_EVENT:
            break;
        case LogEvent.WRITE_ROWS_EVENT_V1:
        case LogEvent.WRITE_ROWS_EVENT:
            return parseRowsEvent((WriteRowsLogEvent) logEvent);
        case LogEvent.UPDATE_ROWS_EVENT_V1:
        case LogEvent.PARTIAL_UPDATE_ROWS_EVENT:
        case LogEvent.UPDATE_ROWS_EVENT:
            return parseRowsEvent((UpdateRowsLogEvent) logEvent);
        case LogEvent.DELETE_ROWS_EVENT_V1:
        case LogEvent.DELETE_ROWS_EVENT:
            return parseRowsEvent((DeleteRowsLogEvent) logEvent);
        case LogEvent.ROWS_QUERY_LOG_EVENT:
            return parseRowsQueryEvent((RowsQueryLogEvent) logEvent);
        case LogEvent.ANNOTATE_ROWS_EVENT:
            return parseAnnotateRowsEvent((AnnotateRowsEvent) logEvent);
        case LogEvent.USER_VAR_EVENT:
            return parseUserVarLogEvent((UserVarLogEvent) logEvent);
        case LogEvent.INTVAR_EVENT:
            return parseIntrvarLogEvent((IntvarLogEvent) logEvent);
        case LogEvent.RAND_EVENT:
            return parseRandLogEvent((RandLogEvent) logEvent);
        case LogEvent.GTID_LOG_EVENT:
            return parseGTIDLogEvent((GtidLogEvent) logEvent);
        case LogEvent.HEARTBEAT_LOG_EVENT:
            return parseHeartbeatLogEvent((HeartbeatLogEvent) logEvent);
        default:
            break;
    }

    return null;
}
 
Example #8
Source File: DirectLogFetcherTest.java    From canal-1.1.3 with Apache License 2.0 4 votes vote down vote up
protected void parseAnnotateRowsEvent(AnnotateRowsEvent event) throws Exception {
    System.out.println(String.format("================> binlog[%s:%s]", binlogFileName, event.getHeader()
        .getLogPos() - event.getHeader().getEventLen()));
    System.out.println("sql : " + new String(event.getRowsQuery().getBytes("ISO-8859-1"), charset.name()));
}
 
Example #9
Source File: LogEventConvert.java    From DBus with Apache License 2.0 4 votes vote down vote up
public Entry parse(LogEvent logEvent) throws CanalParseException {
    if (logEvent == null || logEvent instanceof UnknownLogEvent) {
        return null;
    }

    int eventType = logEvent.getHeader().getType();
    switch (eventType) {
        case LogEvent.ROTATE_EVENT:
            binlogFileName = ((RotateLogEvent) logEvent).getFilename();
            break;
        case LogEvent.QUERY_EVENT:
            return parseQueryEvent((QueryLogEvent) logEvent);
        case LogEvent.XID_EVENT:
            return parseXidEvent((XidLogEvent) logEvent);
        case LogEvent.TABLE_MAP_EVENT:
            break;
        case LogEvent.WRITE_ROWS_EVENT_V1:
        case LogEvent.WRITE_ROWS_EVENT:
            return parseRowsEvent((WriteRowsLogEvent) logEvent);
        case LogEvent.UPDATE_ROWS_EVENT_V1:
        case LogEvent.UPDATE_ROWS_EVENT:
            return parseRowsEvent((UpdateRowsLogEvent) logEvent);
        case LogEvent.DELETE_ROWS_EVENT_V1:
        case LogEvent.DELETE_ROWS_EVENT:
            return parseRowsEvent((DeleteRowsLogEvent) logEvent);
        case LogEvent.ROWS_QUERY_LOG_EVENT:
            return parseRowsQueryEvent((RowsQueryLogEvent) logEvent);
        case LogEvent.ANNOTATE_ROWS_EVENT:
            return parseAnnotateRowsEvent((AnnotateRowsEvent) logEvent);
        case LogEvent.USER_VAR_EVENT:
            return parseUserVarLogEvent((UserVarLogEvent) logEvent);
        case LogEvent.INTVAR_EVENT:
            return parseIntrvarLogEvent((IntvarLogEvent) logEvent);
        case LogEvent.RAND_EVENT:
            return parseRandLogEvent((RandLogEvent) logEvent);
        default:
            break;
    }

    return null;
}
 
Example #10
Source File: LogEventConvert_old.java    From DBus with Apache License 2.0 4 votes vote down vote up
public Entry parse(LogEvent logEvent) throws CanalParseException {
    if (logEvent == null || logEvent instanceof UnknownLogEvent) {
        return null;
    }

    int eventType = logEvent.getHeader().getType();
    switch (eventType) {
        case LogEvent.ROTATE_EVENT:
            binlogFileName = ((RotateLogEvent) logEvent).getFilename();
            break;
        case LogEvent.QUERY_EVENT:
            return parseQueryEvent((QueryLogEvent) logEvent);
        case LogEvent.XID_EVENT:
            return parseXidEvent((XidLogEvent) logEvent);
        case LogEvent.TABLE_MAP_EVENT:
            break;
        case LogEvent.WRITE_ROWS_EVENT_V1:
        case LogEvent.WRITE_ROWS_EVENT:
            return parseRowsEvent((WriteRowsLogEvent) logEvent);
        case LogEvent.UPDATE_ROWS_EVENT_V1:
        case LogEvent.UPDATE_ROWS_EVENT:
            return parseRowsEvent((UpdateRowsLogEvent) logEvent);
        case LogEvent.DELETE_ROWS_EVENT_V1:
        case LogEvent.DELETE_ROWS_EVENT:
            return parseRowsEvent((DeleteRowsLogEvent) logEvent);
        case LogEvent.ROWS_QUERY_LOG_EVENT:
            return parseRowsQueryEvent((RowsQueryLogEvent) logEvent);
        case LogEvent.ANNOTATE_ROWS_EVENT:
            return parseAnnotateRowsEvent((AnnotateRowsEvent) logEvent);
        case LogEvent.USER_VAR_EVENT:
            return parseUserVarLogEvent((UserVarLogEvent) logEvent);
        case LogEvent.INTVAR_EVENT:
            return parseIntrvarLogEvent((IntvarLogEvent) logEvent);
        case LogEvent.RAND_EVENT:
            return parseRandLogEvent((RandLogEvent) logEvent);
        default:
            break;
    }

    return null;
}
 
Example #11
Source File: LogEventConvert.java    From DBus with Apache License 2.0 4 votes vote down vote up
public Entry parse(LogEvent logEvent) throws CanalParseException {
    if (logEvent == null || logEvent instanceof UnknownLogEvent) {
        return null;
    }

    int eventType = logEvent.getHeader().getType();
    switch (eventType) {
        case LogEvent.ROTATE_EVENT:
            binlogFileName = ((RotateLogEvent) logEvent).getFilename();
            break;
        case LogEvent.QUERY_EVENT:
            return parseQueryEvent((QueryLogEvent) logEvent);
        case LogEvent.XID_EVENT:
            return parseXidEvent((XidLogEvent) logEvent);
        case LogEvent.TABLE_MAP_EVENT:
            break;
        case LogEvent.WRITE_ROWS_EVENT_V1:
        case LogEvent.WRITE_ROWS_EVENT:
            return parseRowsEvent((WriteRowsLogEvent) logEvent);
        case LogEvent.UPDATE_ROWS_EVENT_V1:
        case LogEvent.UPDATE_ROWS_EVENT:
            return parseRowsEvent((UpdateRowsLogEvent) logEvent);
        case LogEvent.DELETE_ROWS_EVENT_V1:
        case LogEvent.DELETE_ROWS_EVENT:
            return parseRowsEvent((DeleteRowsLogEvent) logEvent);
        case LogEvent.ROWS_QUERY_LOG_EVENT:
            return parseRowsQueryEvent((RowsQueryLogEvent) logEvent);
        case LogEvent.ANNOTATE_ROWS_EVENT:
            return parseAnnotateRowsEvent((AnnotateRowsEvent) logEvent);
        case LogEvent.USER_VAR_EVENT:
            return parseUserVarLogEvent((UserVarLogEvent) logEvent);
        case LogEvent.INTVAR_EVENT:
            return parseIntrvarLogEvent((IntvarLogEvent) logEvent);
        case LogEvent.RAND_EVENT:
            return parseRandLogEvent((RandLogEvent) logEvent);
        default:
            break;
    }

    return null;
}
 
Example #12
Source File: BaseLogFetcherTest.java    From canal with Apache License 2.0 4 votes vote down vote up
protected void parseAnnotateRowsEvent(AnnotateRowsEvent event) throws Exception {
    System.out.println(String.format("================> binlog[%s:%s]", binlogFileName, event.getHeader()
        .getLogPos() - event.getHeader().getEventLen()));
    System.out.println("sql : " + new String(event.getRowsQuery().getBytes("ISO-8859-1"), charset.name()));
}
 
Example #13
Source File: LogEventConvert.java    From canal with Apache License 2.0 4 votes vote down vote up
@Override
public Entry parse(LogEvent logEvent, boolean isSeek) throws CanalParseException {
    if (logEvent == null || logEvent instanceof UnknownLogEvent) {
        return null;
    }

    int eventType = logEvent.getHeader().getType();
    switch (eventType) {
        case LogEvent.QUERY_EVENT:
            return parseQueryEvent((QueryLogEvent) logEvent, isSeek);
        case LogEvent.XID_EVENT:
            return parseXidEvent((XidLogEvent) logEvent);
        case LogEvent.TABLE_MAP_EVENT:
            break;
        case LogEvent.WRITE_ROWS_EVENT_V1:
        case LogEvent.WRITE_ROWS_EVENT:
            return parseRowsEvent((WriteRowsLogEvent) logEvent);
        case LogEvent.UPDATE_ROWS_EVENT_V1:
        case LogEvent.PARTIAL_UPDATE_ROWS_EVENT:
        case LogEvent.UPDATE_ROWS_EVENT:
            return parseRowsEvent((UpdateRowsLogEvent) logEvent);
        case LogEvent.DELETE_ROWS_EVENT_V1:
        case LogEvent.DELETE_ROWS_EVENT:
            return parseRowsEvent((DeleteRowsLogEvent) logEvent);
        case LogEvent.ROWS_QUERY_LOG_EVENT:
            return parseRowsQueryEvent((RowsQueryLogEvent) logEvent);
        case LogEvent.ANNOTATE_ROWS_EVENT:
            return parseAnnotateRowsEvent((AnnotateRowsEvent) logEvent);
        case LogEvent.USER_VAR_EVENT:
            return parseUserVarLogEvent((UserVarLogEvent) logEvent);
        case LogEvent.INTVAR_EVENT:
            return parseIntrvarLogEvent((IntvarLogEvent) logEvent);
        case LogEvent.RAND_EVENT:
            return parseRandLogEvent((RandLogEvent) logEvent);
        case LogEvent.GTID_LOG_EVENT:
            return parseGTIDLogEvent((GtidLogEvent) logEvent);
        case LogEvent.HEARTBEAT_LOG_EVENT:
            return parseHeartbeatLogEvent((HeartbeatLogEvent) logEvent);
        default:
            break;
    }

    return null;
}
 
Example #14
Source File: DirectLogFetcherTest.java    From canal with Apache License 2.0 4 votes vote down vote up
protected void parseAnnotateRowsEvent(AnnotateRowsEvent event) throws Exception {
    System.out.println(String.format("================> binlog[%s:%s]", binlogFileName, event.getHeader()
        .getLogPos() - event.getHeader().getEventLen()));
    System.out.println("sql : " + new String(event.getRowsQuery().getBytes("ISO-8859-1"), charset.name()));
}