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

Enable db_test running in Centos 32 bit OS and Alpine 32 bit OS #9294

Closed
wants to merge 9 commits into from

Conversation

sike-evolve
Copy link
Contributor

@sike-evolve sike-evolve commented Dec 13, 2021

Closes #9271

@adamretter
Copy link
Collaborator

Just to add that we have also prepared CircleCI jobs for testing this here - #7876

@sike-evolve sike-evolve marked this pull request as ready for review December 20, 2021 16:13
db/db_test.cc Outdated
@@ -2743,7 +2743,10 @@ TEST_P(MultiThreadedDBTest, MultiThreaded) {
thread[id].state = &mt;
thread[id].id = id;
thread[id].multiget_batched = multiget_batched_;
env_->StartThread(MTThreadBody, &thread[id]);
// Cannot use env_->StartThread because the thread needs to be detached.
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't make sense. env_->StartThread only creates detached threads. If it's not working, it needs to be fixed.

And this code (probably ancient) would be much better off with joinable threads anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already changed the code from detached threads to joinable threads

db/db_test.cc Outdated
@@ -6836,9 +6843,15 @@ TEST_F(DBTest, LargeBlockSizeTest) {
CreateAndReopenWithCF({"pikachu"}, options);
ASSERT_OK(Put(0, "foo", "bar"));
BlockBasedTableOptions table_options;
table_options.block_size = 8LL * 1024 * 1024 * 1024LL;
table_options.block_size = (size_t)(8LL * 1024 * 1024 * 1024LL);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a weird way to construct a size_t, and you have made this a "bad" test because it's mandating--only on 32-bit--that block_size = 0 be accepted, which is weird.

Ideally we'd change block_size to uint64_t so that it's less error-prone, and that should also eliminate the need for special cases in test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we'd change block_size to uint64_t so that it's less error-prone, and that should also eliminate the need for special cases in test.

While technically a breaking change for source compatibility in obscure cases, it's the kind we would easily accept in a minor release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already changed block_size from size_t to uint64_t.

util/regex.cc Outdated
@@ -26,7 +26,7 @@ bool Regex::Matches(const std::string &str) const {
return std::regex_match(str, *impl_);
} else {
// Should not call Matches on unset Regex
assert(false);
// assert(false);
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.

db_test fails in 32 bit platform.

[==========] Running 169 tests from 3 test cases.
[----------] Global test environment set-up.
[----------] 102 tests from DBTest
[ RUN ] DBTest.MockEnvTest
db_test: util/regex.cc:29: bool rocksdb::Regex::Matches(const string&) const: Assertion `false' failed.
Received signal 6 (Aborted)

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be resolved by #9264.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the commented code. Please review it.

env/fs_posix.cc Outdated
@@ -238,7 +238,11 @@ class PosixFileSystem : public FileSystem {
}
SetFD_CLOEXEC(fd, &options);

if (options.use_mmap_reads && sizeof(void*) >= 8) {
// Remove 64 bit OS checking. Both 64 and 32 bit OSes use mmap to read files
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to explain an old, unnatural state of the code here. That's what release notes are for.

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

db/db_test.cc Outdated Show resolved Hide resolved
@sike-evolve sike-evolve changed the title Enable db_test running in Centos 32 bit OS Enable db_test running in Centos 32 bit OS and Alpine 32 bit OS Dec 22, 2021
Copy link
Contributor

@pdillinger pdillinger left a comment

Choose a reason for hiding this comment

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

Thanks for the work!

db/db_test.cc Outdated
static void MTThreadBody(void* arg) {
MTThread* t = reinterpret_cast<MTThread*>(arg);
int id = t->id;
DB* db = t->state->test->db_;
int counter = 0;
auto start = std::chrono::high_resolution_clock::now();
Copy link
Contributor

Choose a reason for hiding this comment

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

How about

std::shared_ptr<SystemClock> clock = SystemClock::Default();
auto end_micros = clock->NowMicros() + kTestSeconds * 1000000U;
...
while (clock->NowMicros() < end_micros) {

(And change kTestSeconds to unsigned)

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

db/db_test.cc Outdated
@@ -2587,15 +2585,23 @@ struct MTThread {
bool multiget_batched;
};

// Based on Peter Dillinger's suggestion, the threads have been changed from
Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessary. Thanks. Someone can use git blame if they want to see the history of this test.

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

db/db_test.cc Outdated
env_->SleepForMicroseconds(100000);
}
}
// Based on Peter Dillinger's suggestion, the threads have been changed from
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment not necessary. Thanks

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

db/db_test.cc Outdated Show resolved Hide resolved
@adamretter
Copy link
Collaborator

@pdillinger Now we have reconciled the Snappy issue to an older version of Snappy shipped on older versions of Alpine, are you happy with this PR?

db/db_test.cc Outdated

// The default compaction method snappy does not work on Alpine 32 platform
// That means there is no compression
// The following test case has been disabled on 32 bit platform
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this comment now obsolete?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now I removed this comment.

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@pdillinger pdillinger left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

pdillinger added a commit to pdillinger/rocksdb that referenced this pull request Jan 14, 2022
Summary: Loose ends relate to mmap on 32-bit systems. (Testing is more
complicated when the feature is completely disabled on 32-bit.)

Test Plan: CI
facebook-github-bot pushed a commit that referenced this pull request Jan 21, 2022
Summary:
Loose ends relate to mmap on 32-bit systems. (Testing is more
complicated when the feature was completely disabled on 32-bit.)

Pull Request resolved: #9386

Test Plan: CI

Reviewed By: ajkr

Differential Revision: D33590715

Pulled By: pdillinger

fbshipit-source-id: f2637036a538a552200adee65b6765fce8cae27b
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.

How best to fix db_test on 32 bit CentOS
6 participants