Skip to content

truncate already parsed bytes instead of unparsed bytes. #40

@AviRaboah

Description

@AviRaboah

I found in the code the change of the truncate method in order to improve performance.
but the change cause an issue in case the rest field is greater than 0.

if rest greater than 0 the truncate method will truncate from self.bytes the first remaining bytes number which included some of the parsed bytes.

that scenario cause the next iteration to parse the same packet instead of the remaining packet it should be read from the beginning.

https://github.com/datafuselabs/opensrv/blob/b44c9d1360da297b305abf33aecfa94888e1554c/mysql/src/packet_reader.rs#L140-L152

one optional fix - maybe instead of truncate the bytes vector you can set the start value to be the correct one to start from for next iteration.

but I want to consult with you guys before I change some low level code like that.

thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions