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 a particular test case for HGETALL with async_io=true #1401

Merged
merged 4 commits into from
Apr 24, 2023

Conversation

torwig
Copy link
Contributor

@torwig torwig commented Apr 23, 2023

The bug was reproducible with RocksDB v8.0.0, large values in a hash set (>512 bytes).
After the COMPACT command was executed, HGETALL/HVALS/HKEYS couldn't "see" all the elements of the hash set. However, HGET could find those values.
It looked like the iterator via the snapshot didn't see them for some reason.
Since the version of the RocksDB was bumped to v8.0.1, the bug disappeared.

Adding the test case to prevent facing this bug in the future.

This is the output of the failed test:

--- FAIL: TestHashWithAsyncIOEnabled (6.10s)
    --- FAIL: TestHashWithAsyncIOEnabled/Test_rare_bug_with_large_value_after_compaction (5.03s)
        hash_test.go:1587: 
            	Error Trace:	/home/yaroslav/programming/kvrocks/tests/gocase/unit/type/hash/hash_test.go:1587
            	Error:      	Not equal: 
            	            	expected: 50
            	            	actual  : 2
            	Test:       	TestHashWithAsyncIOEnabled/Test_rare_bug_with_large_value_after_compaction
FAIL
exit status 1

Was reproducible with RocksDB v8.0.0, large values in a hash set (>512 bytes).
After the COMPACT command was executed, HGETALL/HVALS/HKEYS couldn't "see"
all the elements of the hash set. However, HGET could find those values.
It looked like the iterator via the snapshot didn't see them for some reason.
Since the version of the RocksDB was bumped to v8.0.1, the bug disappeared.
@aleksraiden
Copy link
Contributor

@torwig thanks for help in discovering this bug

git-hulk
git-hulk previously approved these changes Apr 23, 2023
Copy link
Member

@git-hulk git-hulk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

tisonkun
tisonkun previously approved these changes Apr 23, 2023
Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

tests/gocase/unit/type/hash/hash_test.go Outdated Show resolved Hide resolved
tests/gocase/unit/type/hash/hash_test.go Outdated Show resolved Hide resolved

require.NoError(t, rdb.Do(ctx, "COMPACT").Err())

time.Sleep(5 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to be unstable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by unstable? Since the COMPACT command is asynchronous, I add the time.Sleep call here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your explanation :)

Generally, sleep is unpredictable, so it may sleep too short and miss the correct condition. I asked here for more background. If we cannot have a determinate latch for COMPACT completion, I'm OK with current way.

@torwig torwig dismissed stale reviews from tisonkun and git-hulk via 2d22d4f April 24, 2023 07:38
@torwig
Copy link
Contributor Author

torwig commented Apr 24, 2023

Ooops, not the correct branch. I'll re-push now.

@torwig
Copy link
Contributor Author

torwig commented Apr 24, 2023

Now it's OK.

@git-hulk
Copy link
Member

Thanks all, merging...

@git-hulk git-hulk merged commit 6423c99 into apache:unstable Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants