RFR: 8314120: Add tests for FileDescriptor.sync [v2]

Aleksey Shipilev shade at openjdk.org
Fri Aug 11 15:32:58 UTC 2023


> When backporting [JDK-8312127](https://bugs.openjdk.org/browse/JDK-8312127), I realized there are no targeted tests for `FileDescriptor.sync` that can be used to qualify the changes in that area. 
> 
> Additionally, we use `FD.sync` for durability in Java databases, and we want to make sure at least some smoke tests are available in OpenJDK. Asserting durability would be hard, but let's at least test the Java code does not throw unexpected exceptions and native code does not crash the VM.
> 
> The benchmark will show, among other things, that the recent change to `FileDescriptor.sync` does not affect the performance much, compared to the cost of the `fsync` itself. It deliberately targets tmpfs to provide the lowest actual FS overhead.
> 
> 
> Benchmark                Mode  Cnt    Score   Error  Units
> 
> # Before JDK-8312127
> FileDescriptorSync.sync  avgt   15  351,688 ? 2,477  ns/op
> 
> # After JDK-8312127
> FileDescriptorSync.sync  avgt   15  353,331 ? 2,116  ns/op
> 
> 
> The new regression test completes in <0.5s on my Mac.

Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:

  Review comments

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/15231/files
  - new: https://git.openjdk.org/jdk/pull/15231/files/19f8c6fb..e66c244a

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15231&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15231&range=00-01

  Stats: 32 lines in 1 file changed: 18 ins; 8 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/15231.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15231/head:pull/15231

PR: https://git.openjdk.org/jdk/pull/15231


More information about the core-libs-dev mailing list