Skip to content

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

Closed
sike-evolve wants to merge 9 commits into
meta:mainfrom
sike-evolve:bugfix/591
Closed

sike-evolve wants to merge 9 commits into
meta:mainfrom
sike-evolve:bugfix/591

Conversation

@sike-evolve

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

Copy link
Copy Markdown
Contributor

Closes #9271

@adamretter

Copy link
Copy Markdown
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
Comment thread db/db_test.cc Outdated
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
Copy Markdown
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
Copy Markdown
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

Comment thread db/db_test.cc Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread util/regex.cc Outdated
} else {
// Should not call Matches on unset Regex
assert(false);
// assert(false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread env/fs_posix.cc Outdated
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread db/db_test.cc 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

@pdillinger pdillinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the work!

Comment thread db/db_test.cc Outdated
int id = t->id;
DB* db = t->state->test->db_;
int counter = 0;
auto start = std::chrono::high_resolution_clock::now();

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread db/db_test.cc Outdated
bool multiget_batched;
};

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

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

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

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread db/db_test.cc Resolved
@adamretter

Copy link
Copy Markdown
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?

Comment thread 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

@pdillinger pdillinger left a comment

Copy link
Copy Markdown
Contributor

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
Tim-Reed pushed a commit to Tim-Reed/rocksdb that referenced this pull request Oct 1, 2026
…#9294)

Summary:
Closes meta#9271

Pull Request resolved: meta#9294

Reviewed By: riversand963, hx235

Differential Revision: D33586002

Pulled By: pdillinger

fbshipit-source-id: 3d1a2fa71023e108613ff03dbd37a5f954fc4920
Tim-Reed pushed a commit to Tim-Reed/rocksdb that referenced this pull request Oct 1, 2026
)

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: meta#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