Repository navigation
Description
We (CC @adamretter) have been working toward integrating 32 bit containers into CircleCI, as these are already used for RocksJava releases.
As part of this work we noticed some issues with running RocksDB on 32 bit Linux, most of these we have now resolved and we will send PR shortly.
However, there is one 32 bit issue that we could fix in a number of different ways, as such we would like to first seek out the opinion of the RocksDB team on the approach they prefer before we send the PR.
Specifically, when running db_test on 32 bit CentOS we see the following test failure:
db/db_test.cc:546: Failure
Flush(1)
IO error: While pread offset 0 len 629: /tmp/rocksdbtest-0//db_test_2122_890971060/000014.sst: Bad address
[ FAILED ] DBTest.ReadFromPersistedTier (1172 ms)
[ RUN ] DBTest.SingleDeleteFlush
db/db_test.cc:627: Failure
Flush(1)
IO error: While pread offset 0 len 629: /tmp/rocksdbtest-0//db_test_2122_890971060/000014.sst: Bad address
[ FAILED ] DBTest.SingleDeleteFlush (1157 ms)
[ RUN ] DBTest.SingleDeletePutFlush
db/db_test.cc:666: Failure
Flush(1)
IO error: While pread offset 0 len 608: /tmp/rocksdbtest-0//db_test_2122_890971060/000014.sst: Bad address
[ FAILED ] DBTest.SingleDeletePutFlush (1107 ms)
When I analyzed the problem of "IO error: While pread offset 0 len 629: /tmp/rocksdbtest-0//db_test_2122_890971060/000014.sst: Bad address", I found the problem was coming from fs_posix.cc:241.
Ultimately the test is creating a new PosixMmapReadableFile for 64 bit OS or a new PosixRandomAccessFile for 32 bit OS, however a subsequent call to rocksdb::PlainTableReader::MmapDataIfNeeded occurs on both 32 bit OS and 64 bit OS.
Here is the problem. rocksdb::PlainTableReader::MmapDataIfNeeded calls read function with the empty buffer, the read function in PosixMmapReadableFile does not need a buffer, but the read function in PosixRandomAccessFile does need a buffer. This causes a read error.
I see two possible solutions to fix this problem:
- Remove the 32 bit checking, both 32 bit and 64 bit use
PosixMmapReadableFileto read file. Here is the code change:
if (options.use_mmap_reads/* && sizeof(void*) >= 8*/)- Provide a buffer for the read function in
PosixRandomAccessFile. Here is the code change inPlainTableReader::MmapDataIfNeeded()table/plain/plain_table_reader.cc:291:
random_access_read_buff_.resize(file_size_ + 1);
return file_info_.file->Read(IOOptions(), 0,
static_cast<size_t>(file_size_),
&file_info_.file_data, &random_access_read_buff_[0], nullptr);Please find attached the call stacks from tracking this on both 32bit and 64 bit machines:
Activity
[-]DB_test fails on 32 bit Centos[/-][+]How best to fix db_test on 32 bit CentOS[/+]pdillinger commentedon Dec 10, 2021
My quick analysis suggests that the 64-bit check should be removed, because it basically overrides the user's non-default choice in behavior. First added in b85cdca (nothing interesting that wasn't captured in the comment).
But this is a behavior change for 32-bit that would need an entry in HISTORY.md
Enable db_test running in Centos 32 bit OS and Alpine 32 bit OS (#9294)
Enable db_test running in Centos 32 bit OS and Alpine 32 bit OS (meta…