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

Fix FIFO Compaction with TTL tests #2650

Closed
wants to merge 2 commits into from

Conversation

sagar0
Copy link
Contributor

@sagar0 sagar0 commented Jul 27, 2017

  • FIFOCompactionWithTTLTest was flaky when run in parallel earlier, and hence it was disabled. Fixed it now.
  • Also, faking sleep now instead of really sleeping to make tests more realistic by using TTLs like 1 hour and 1 day.

Test Plan:
make check

for x in $(seq 1000); do TEST_TMPDIR=/dev/shm/$x ./db_test --gtest_filter=DBTest.FIFOCompactionWithTTLTest & done

db/db_test.cc Outdated
// sleep for 5 seconds
env_->SleepForMicroseconds(5 * 1000 * 1000);
// sleep for 2 seconds
env_->SleepForMicroseconds(2 * 1000 * 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

What this sleep waiting for? Will it work if we remove the sleep?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the test will not work if the the sleep is removed. This sleep is waiting for the ttl to expire.
On line 2863, I initially set the TTL to 1 hour (arbitrary), and created all the files. On line 2885, I then change the TTL to 1 second ... but since at least 2 seconds have passed by now due to sleeping, all the files are ready for compaction/deletion because of ttl expriy. Line 2889 shows that all the files are deleted.

MemEnv provides a method to mock sleep by doing a FakeSleepForMicroseconds. I wish I could use it to sleep longer to mimic realistic TTL values, say, like 1 day or 1 week. But I couldn't yet get FakeSleep to work even after spending considerable time and effort.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Put a inline comment here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, will add a comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, didn't know about this. Sure, let me try. It'd be great if this works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Able to fake sleep now, based on Siying's suggestion.

Copy link
Contributor

@yiwu-arbug yiwu-arbug left a comment

Choose a reason for hiding this comment

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

LGTM.

@facebook-github-bot
Copy link
Contributor

@sagar0 updated the pull request - view changes - changes since last import

Copy link
Contributor

@yiwu-arbug yiwu-arbug left a comment

Choose a reason for hiding this comment

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

Awesome!

@facebook-github-bot
Copy link
Contributor

@sagar0 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@sagar0 updated the pull request - view changes - changes since last import

@facebook-github-bot
Copy link
Contributor

@sagar0 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@sagar0 sagar0 deleted the fix-fifo-tests branch July 31, 2017 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants