GithubHelp home page GithubHelp logo

NPE Found when i'm using search by sk and a doubt about how to get the root page id of the secondary index? about innodb-java-reader HOT 4 CLOSED

alibaba avatar alibaba commented on May 5, 2024
NPE Found when i'm using search by sk and a doubt about how to get the root page id of the secondary index?

from innodb-java-reader.

Comments (4)

neoremind avatar neoremind commented on May 5, 2024

Good catch!

Just as the javadoc explains:

Get secondary key root page number.
Find clustered index root page and calculate sk page number based on it. Note that if table has ever been altered to add or remove indices, the secondary key root page number may be incorrect, and cause error.
MySQL will set FULLTEXT KEY, UNIQUE KEY ahead of normal KEY, but in SHOW CREATE TABLE command, the FULLTEXT KEY goes to the end, so here the workaround is to add the delta of fulltext key count.
More standard way would be to look up root page number by: SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES; before 5.7 or SELECT * FROM INFORMATION_SCHEMA.INNODB_INDEXES; after 8.0

Currently sk root page number will be calculated per above. To locate the exact page number, the system tablespace is the where to find, but now the framework is not able to read system table to retrieve the information. So that's why the class name is Workaround. PR is welcomed.

BTW, The command to query by sk:

java -jar /Users/xu/IdeaProjects/innodb-java-reader-ali-github/innodb-java-reader-cli/target/innodb-java-reader-cli.jar \
  -ibd-file-path /usr/local/mysql/data/test/issue.ibd \
  -create-table-sql-file-path issue.sql \
 -showheader  -c query-by-sk  -args ">=;0;<;0" -skname idx_name

from innodb-java-reader.

xiaoma20082008 avatar xiaoma20082008 commented on May 5, 2024

Got it, Thank you!!! @neoremind

from innodb-java-reader.

neoremind avatar neoremind commented on May 5, 2024

@xiaoma20082008 I have delivered a new release, you can specify secondary key root page number if necessary, please refer to https://github.com/alibaba/innodb-java-reader/blob/master/docs/FAQ.md#1-how-to-specify-secondary-key-root-page-number. Any questions, feel free to let me know.

from innodb-java-reader.

xiaoma20082008 avatar xiaoma20082008 commented on May 5, 2024

LGTM! Thank you!

from innodb-java-reader.

Related Issues (14)

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.