-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Conversation
Just to add that we have also prepared CircleCI jobs for testing this here - #7876 |
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment not necessary. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
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
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
Closes #9271