Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more limitation on searchPage #403

Closed
wants to merge 1 commit into from
Closed

Add more limitation on searchPage #403

wants to merge 1 commit into from

Conversation

shippomx
Copy link

@shippomx shippomx commented Feb 9, 2023

To avoid goroutine stack exceeds 1000000000-byte limit.
Some records may result to func cursor.search() and cursor.searchPage recusively called.

Fixes: #402

Signed-off-by: Miao Xia xia.miao1@zte.com.cn

To avoid goroutine stack exceeds 1000000000-byte limit.
Some records may result to func `cursor.searh()` and `cursor.searchPage` recusively
called.

Fixes: #402

Signed-off-by: Miao Xia <xia.miao1@zte.com.cn>
@ptabor
Copy link
Contributor

ptabor commented Feb 11, 2023

I don't understand what's the underlying problem. Is it a single page corrupted that triggers the problem and you want to avoid navigation within a corrupted page ?

@shippomx
Copy link
Author

You are right, i don't know how to repair the db, then i try to aviod this.

I don't understand what's the underlying problem. Is it a single page corrupted that triggers the problem and you want to avoid navigation within a corrupted page ?

@shippomx shippomx closed this by deleting the head repository Feb 20, 2023
@shippomx
Copy link
Author

shippomx commented Mar 1, 2023

@ptabor Can you tell me what the difference between this commit's changes? I think it's necessarily to add the guard code:

if bytes.HasPrefix(inodes[i].key(), key) {

@shippomx shippomx reopened this Mar 2, 2023
@ptabor ptabor changed the title Add more limitation on searhPage Add more limitation on searchPage Mar 2, 2023
@ptabor
Copy link
Contributor

ptabor commented Mar 2, 2023

I don't think it's a correct solution.

sort.Search spec says:

Search requires that f is false for some (possibly empty) prefix of the input range [0, n) and then true for the (possibly empty) remainder;

your change makes the function returns false for values 'before' and 'after' the interesting RANGE (that is a prefix).
This does not allow the bi-sect to work properly.

Please use the fixed file provided by @ahrtr.

@ptabor ptabor closed this Mar 2, 2023
@shippomx
Copy link
Author

shippomx commented Mar 3, 2023

Thank, I have understood the differences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Branch page items link to already released pages
2 participants