Skip to content

Run the lazy entity tests with a recording file system on the test Env (#15815) - #15815

Open
xingbowang wants to merge 1 commit into
meta:mainfrom
xingbowang:export-D134916660
Open

xingbowang wants to merge 1 commit into
meta:mainfrom
xingbowang:export-D134916660

Conversation

@xingbowang

@xingbowang xingbowang commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Before this change, DBLazyEntityEmbeddedMultiReadTest.EmptyRangeInsideMergedReadGetsOK failed in the CI job that runs the unit tests with ENCRYPTED_ENV=1 (build-linux-encrypted_env-no_compression). The test came from #15780.

Background: DBTestBase::env_ is the Env of the test run. It is an encrypted Env with ENCRYPTED_ENV, and an in-memory Env with MEM_ENV. Most tests in db/wide/db_lazy_entity_test.cc open the DB on env_. 18 tests instead count the reads that reach the files, so they put a recording file system (BlobReadIOActivityFS) under the DB. Each of them built it on FileSystem::Default(), at 8 places (from #15067, #15178 and #15780). So these DBs always ran on the local disk with no encryption:

  • The failing test reads the DB's SST through env_ to get the expected bytes. With ENCRYPTED_ENV, env_ decrypts the plain file into other bytes, and the comparison fails.
  • With ENCRYPTED_ENV, the other 17 tests passed but did not run with encryption.
  • With MEM_ENV, the tests crashed, because the DB and the test fixture used different file systems.

The mismatch went unnoticed because local runs and internal CI run these tests without ENCRYPTED_ENV or MEM_ENV. Only the open-source CI job runs make check with ENCRYPTED_ENV=1, and no CI job runs this binary with MEM_ENV. The earlier places only lost coverage under encryption; the failure appeared when #15780 added the first test that also reads the DB's files through env_.

The fixture DBLazyEntityTest now has one helper, UseRecordingFs(), that builds the recording file system on env_->GetFileSystem(), sets it in the options, and keeps it alive until the fixture closes the DB. The 18 tests use it instead of their own setup. env_->GetFileSystem() is the base that most db tests use for such wrappers (for example FaultInjectionTestFS). The recorder sits above the encryption layer, so the tests still check what the SST and blob readers send to the file system. Only the test file changes; no RocksDB code changes.

Loose end: other db test files also build file system wrappers on FileSystem::Default(). Some may need the local disk on purpose. Checking them is left for a follow-up.

Differential Revision: D134916660

@meta-cla meta-cla Bot added the CLA Signed label Nov 28, 2026
@meta-codesync

meta-codesync Bot commented Nov 28, 2026

Copy link
Copy Markdown

@xingbowang has exported this pull request. If you are a Meta employee, you can view the originating Diff in D134916660.

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

✅ clang-tidy: No findings on changed lines

Completed in 349.6s.

@meta-codesync meta-codesync Bot changed the title Fix EmptyRangeInsideMergedReadGetsOK with an encrypted test Env Run the lazy entity tests with a recording file system on the test Env Nov 29, 2026
xingbowang added a commit to xingbowang/rocksdb that referenced this pull request Nov 29, 2026
meta#15815)

Summary:
Pull Request resolved: meta#15815

`DBLazyEntityEmbeddedMultiReadTest.EmptyRangeInsideMergedReadGetsOK` fails in the CI job that runs the unit tests with `ENCRYPTED_ENV=1` (build-linux-encrypted_env-no_compression). The test came from meta#15780.

Background: `DBTestBase::env_` is the Env of the test run. It is an encrypted Env with `ENCRYPTED_ENV`, and an in-memory Env with `MEM_ENV`. Most tests in db/wide/db_lazy_entity_test.cc open the DB on `env_`. 18 tests instead count the reads that reach the files, so they put a recording file system (`BlobReadIOActivityFS`) under the DB. Each of them built it on `FileSystem::Default()`, at 8 places (from meta#15067, meta#15178 and meta#15780). So these DBs always ran on the local disk with no encryption:
- The failing test reads the DB's SST through `env_` to get the expected bytes. With `ENCRYPTED_ENV`, `env_` decrypts the plain file into other bytes, and the comparison fails.
- With `ENCRYPTED_ENV`, the other 17 tests passed but did not run with encryption.
- With `MEM_ENV`, the tests crashed, because the DB and the test fixture used different file systems.

The fixture `DBLazyEntityTest` now has one helper, `UseRecordingFs()`, that builds the recording file system on `env_->GetFileSystem()`, sets it in the options, and keeps it alive until the fixture closes the DB. The 18 tests use it instead of their own setup. Only the test file changes; no RocksDB code changes.

Differential Revision: D134916660
@meta-codesync meta-codesync Bot changed the title Run the lazy entity tests with a recording file system on the test Env Run the lazy entity tests with a recording file system on the test Env (#15815) Nov 29, 2026
xingbowang added a commit to xingbowang/rocksdb that referenced this pull request Nov 29, 2026
meta#15815)

Summary:

Before this change, `DBLazyEntityEmbeddedMultiReadTest.EmptyRangeInsideMergedReadGetsOK` failed in the CI job that runs the unit tests with `ENCRYPTED_ENV=1` (build-linux-encrypted_env-no_compression). The test came from meta#15780.

Background: `DBTestBase::env_` is the Env of the test run. It is an encrypted Env with `ENCRYPTED_ENV`, and an in-memory Env with `MEM_ENV`. Most tests in db/wide/db_lazy_entity_test.cc open the DB on `env_`. 18 tests instead count the reads that reach the files, so they put a recording file system (`BlobReadIOActivityFS`) under the DB. Each of them built it on `FileSystem::Default()`, at 8 places (from meta#15067, meta#15178 and meta#15780). So these DBs always ran on the local disk with no encryption:
- The failing test reads the DB's SST through `env_` to get the expected bytes. With `ENCRYPTED_ENV`, `env_` decrypts the plain file into other bytes, and the comparison fails.
- With `ENCRYPTED_ENV`, the other 17 tests passed but did not run with encryption.
- With `MEM_ENV`, the tests crashed, because the DB and the test fixture used different file systems.

The mismatch went unnoticed because local runs and internal CI run these tests without `ENCRYPTED_ENV` or `MEM_ENV`. Only the open-source CI job runs `make check` with `ENCRYPTED_ENV=1`, and no CI job runs this binary with `MEM_ENV`. The earlier places only lost coverage under encryption; the failure appeared when meta#15780 added the first test that also reads the DB's files through `env_`.

The fixture `DBLazyEntityTest` now has one helper, `UseRecordingFs()`, that builds the recording file system on `env_->GetFileSystem()`, sets it in the options, and keeps it alive until the fixture closes the DB. The 18 tests use it instead of their own setup. `env_->GetFileSystem()` is the base that most db tests use for such wrappers (for example `FaultInjectionTestFS`). The recorder sits above the encryption layer, so the tests still check what the SST and blob readers send to the file system. Only the test file changes; no RocksDB code changes.

Loose end: other db test files also build file system wrappers on `FileSystem::Default()`. Some may need the local disk on purpose. Checking them is left for a follow-up.

Differential Revision: D134916660
meta#15815)

Summary:
Pull Request resolved: meta#15815

Before this change, `DBLazyEntityEmbeddedMultiReadTest.EmptyRangeInsideMergedReadGetsOK` failed in the CI job that runs the unit tests with `ENCRYPTED_ENV=1` (build-linux-encrypted_env-no_compression). The test came from meta#15780.

Background: `DBTestBase::env_` is the Env of the test run. It is an encrypted Env with `ENCRYPTED_ENV`, and an in-memory Env with `MEM_ENV`. Most tests in db/wide/db_lazy_entity_test.cc open the DB on `env_`. 18 tests instead count the reads that reach the files, so they put a recording file system (`BlobReadIOActivityFS`) under the DB. Each of them built it on `FileSystem::Default()`, at 8 places (from meta#15067, meta#15178 and meta#15780). So these DBs always ran on the local disk with no encryption:
- The failing test reads the DB's SST through `env_` to get the expected bytes. With `ENCRYPTED_ENV`, `env_` decrypts the plain file into other bytes, and the comparison fails.
- With `ENCRYPTED_ENV`, the other 17 tests passed but did not run with encryption.
- With `MEM_ENV`, the tests crashed, because the DB and the test fixture used different file systems.

The mismatch went unnoticed because local runs and internal CI run these tests without `ENCRYPTED_ENV` or `MEM_ENV`. Only the open-source CI job runs `make check` with `ENCRYPTED_ENV=1`, and no CI job runs this binary with `MEM_ENV`. The earlier places only lost coverage under encryption; the failure appeared when meta#15780 added the first test that also reads the DB's files through `env_`.

The fixture `DBLazyEntityTest` now has one helper, `UseRecordingFs()`, that builds the recording file system on `env_->GetFileSystem()`, sets it in the options, and keeps it alive until the fixture closes the DB. The 18 tests use it instead of their own setup. `env_->GetFileSystem()` is the base that most db tests use for such wrappers (for example `FaultInjectionTestFS`). The recorder sits above the encryption layer, so the tests still check what the SST and blob readers send to the file system. Only the test file changes; no RocksDB code changes.

Loose end: other db test files also build file system wrappers on `FileSystem::Default()`. Some may need the local disk on purpose. Checking them is left for a follow-up.

Differential Revision: D134916660

This branch has not been deployed

No deployments
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.

1 participant