Giter Site home page Giter Site logo

Comments (5)

spetrunia avatar spetrunia commented on June 26, 2024

The reason for this is as follows:

  • rowids are mem-comparable forms of PK.
  • mem-comparable forms of PK used to be fixed-length for MyRocks, but since "efficient varchar encoding" they are variable-length.
  • However, MySQL assumes that rowids have fixed length. Currently rowids are zero-padded.
  • When MyRocks attempt to do a PK lookup for rnd_pos(zero-padded-rowid), the record is not found and we have an error.

from mysql-5.6.

spetrunia avatar spetrunia commented on June 26, 2024

Possible solutions:

S1. Let the rowid be PK in KeyTupleFormat. KeyTupleFormat is fixed-length.

  • We will have to provide ha_rocksdb::cmp_ref() function
  • (TODO: is it possible to provide the original (non-mem-comparable) form of PK columns in all cases where MyRocks needs to return a rowid?)

S2. Keep the rowid being mem-comparable form.

  • We will have to know how much end-space bytes are padding, and ha_rocksdb::rnd_pos() should strip them off before doing the index lookup.

from mysql-5.6.

spetrunia avatar spetrunia commented on June 26, 2024

is it possible to provide the original (non-mem-comparable) form of PK columns in all cases where MyRocks needs to return a rowid?)

This doesn't work in all cases.
Consider a case where the PK column uses case-sensitive collation (so one can't restore the value from its mem-comparable form).
Then, suppose we're doing an index-only scan on a secondary index.

In this case, secondary index only gives mem-comparable form of PK columns. We can't restore the original values, and so we can return them in KeyTupleFormat

from mysql-5.6.

spetrunia avatar spetrunia commented on June 26, 2024

We will have to know how much end-space bytes are padding, and ha_rocksdb::rnd_pos() should strip them off before doing the index lookup.

This looks feasible. mem-comparable images of keys are traversed by skip_func which has two possible values:
A. skip_max_length
B. skip_variable_length

skip_variable_length skips data in "varchar encoding". Varchar encoding means 9-byte groups, where the 9th byte varies between 0xFF (no padding bytes) to 0xF7 (all 8 bytes were padding bytes).

That is, if the next 9-byte group is padding it has all zeros, it is zero-padding, otherwise it is not.
If there is less than 9-byte data, it is zero-padding.

from mysql-5.6.

spetrunia avatar spetrunia commented on June 26, 2024

https://reviews.facebook.net/D45639

from mysql-5.6.

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.