Skip to content

Use file descriptors and not c-lib FILE pointers on xBSD #8184

@sonofmom

Description

@sonofmom

Expected behavior

RocksDB should be able to open more then 32767 files on xBSD.

Actual behavior

RocksDB will fail when opening file pointer with number higher then 32767. This is due to following code in FreeBSD (and other xBSD incarnation) C-Lib: https://github.com/freebsd/freebsd-src/blob/main/lib/libc/stdio/fdopen.c#L64-L67.

And this is the line of RocksDB code that invokes fdopen: https://github.com/facebook/rocksdb/blob/master/env/fs_posix.cc#L185

The problem is not caused by OS limits, this is the issue with xBSD not being able to handle a FP with number higher then 32767.

Steps to reproduce the behavior

The problem has been reproduced on FreeBSD v12.2 and v13.0 using latest RocksDB master and large dataset with > 32767 files. Any attempt to open such dataset will result in EMFILE (too many open files) error.

Suggested change

On FreeBSD Forum change from file pointers to file descriptors has been suggested: https://forums.FreeBSD.org/threads/opening-more-then-32767-file-descriptors.79780/post-505682

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions