Skip to content

How best to fix db_test on 32 bit CentOS #9271

Closed

Description

@sike-evolve

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:

  1. Remove the 32 bit checking, both 32 bit and 64 bit use PosixMmapReadableFile to read file. Here is the code change:
if (options.use_mmap_reads/* && sizeof(void*) >= 8*/)
  1. Provide a buffer for the read function in PosixRandomAccessFile. Here is the code change in PlainTableReader::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:

32-bit-call-stack.txt
64-bit-call-stack.txt

Activity

  1. changed the title [-]DB_test fails on 32 bit Centos[/-] [+]How best to fix db_test on 32 bit CentOS[/+] on Dec 8, 2021
  2. pdillinger commented on Dec 10, 2021

    @pdillinger
    Contributor

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions