RFR: 8314120: Add tests for FileDescriptor.sync

Aleksey Shipilev shade at openjdk.org
Thu Aug 10 16:10:59 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.

It 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.


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.

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/jdk/pull/15231/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15231&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8314120
  Stats: 155 lines in 2 files changed: 155 ins; 0 del; 0 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