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

Brian Burkhalter bpb at openjdk.org
Tue Aug 15 15:31:11 UTC 2023


On Fri, 11 Aug 2023 15:32:58 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

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

Looks fine.

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

Marked as reviewed by bpb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15231#pullrequestreview-1578847268


More information about the core-libs-dev mailing list