Coder Social home page Coder Social logo

Comments (9)

siddontang avatar siddontang commented on May 29, 2024

为什么会多出一个字节?正常情况这个多出来的字节应该是个bug了吧,我现在还不清楚。

from go-mysql.

iampastor avatar iampastor commented on May 29, 2024

那为什么python的要加1呢?

from go-mysql.

siddontang avatar siddontang commented on May 29, 2024

不知道,所以我就不清楚啥时候会多出来一个字节了。
这个多出来的字节是协议里面带上的,正常就应该被处理,你那边能确定是什么语句可以导致这个问题?

from go-mysql.

iampastor avatar iampastor commented on May 29, 2024

从binlog信息来看就是普通的Update,并没有特别之处。
不能确定SQL语句是怎样的,因为数据不是我自己提供的,我再看一看能否手动触发这个问题。

from go-mysql.

gdey avatar gdey commented on May 29, 2024

If I'm understanding the original inquiry correctly (Or I should say if google translate is translating it correctly.) Then the problem most likely is in this part of the code:
https://github.com/siddontang/go-mysql/blob/master/replication/row_event.go#L266-L270
We don't check here to see that pos is still within the bound of the len(data) but we do access data using the updated pos.

Now why the python code does a +1 on the byte count read; does not make sense to me either.

from go-mysql.

siddontang avatar siddontang commented on May 29, 2024

Aha, thanks google translate, @gdey .

So how to fix it? use for pos + 1 < len(data) ?
But I still think if we decode data correctly, the updated pos may be the len(data), so only for pos < len(data) is ok.

I think we should construct a case for this.

from go-mysql.

gdey avatar gdey commented on May 29, 2024

I agree with you that pos < len(data) is okay. I don't know why the python code is doing the pos+1. What I was pointing out, was that the index out of range could be happening in those lines. This is because we increment pos, but then don't check to see if it's still less than len(data) before using it. If it happens that the pos is greater than len(data) that would cause and index out of range panic.

from go-mysql.

siddontang avatar siddontang commented on May 29, 2024

@gdey I new an issue in python-mysql-replication for this, maybe @noplay can help us. :-)

from go-mysql.

siddontang avatar siddontang commented on May 29, 2024

@iampastor
what's your binlog row image, minimal, noblob or full?
https://dev.mysql.com/doc/internals/en/binlog-row-image.html

from go-mysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.