jena icon indicating copy to clipboard operation
jena copied to clipboard

kryo5 upgrade

Open Aklakan opened this issue 3 months ago • 5 comments

GitHub issue resolved (no issue created yet).

Pull request Description: Upgrade to kryo5. ~~Need yet to test whether spatial indexes created with kryo4 can be loaded with kryo5. Also, there was an inconsistent use of ConcurrentHashMap and LinkedHashMap that was revealed when a test case failed with kryo5.~~ In my first experiments I was not able to load a spatial index created with kryo4 using kryo5.


  • ~~[ ] Tests are included.~~
  • [x] Commits have been squashed to remove intermediate development commit messages.
  • [x] Key commit messages start with the issue number (GH-xxxx)

By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.


See the Apache Jena "Contributing" guide.

Aklakan avatar Sep 05 '25 20:09 Aklakan

I was not able to load a spatial-index created with kryo4 using kryo5 - it fails to deserialize the ConcurrentHashMap whose registration was missing. Kryo4 auto-registered classes in that case, whereas kryo5 by default requires registration. There is a flag kryo5.setRegistrationRequired(false); but this does not make loading work.

The question is whether to schedule a kryo5 upgrade for Jena6.

Aklakan avatar Sep 10 '25 15:09 Aklakan

The question is whether to schedule a kryo5 upgrade for Jena6.

Probably, yes. It is safer.

A major version change to Jena comes every 2 years when the supported java version changes so the opportunity is now.

Running both, while possible, is a maintenance cost.

Even if Kryo4 works now, bug fixes and security fixes will likely be to kryo5 first. I don't see much development around kryo4.

Choosing Kryo5 does not impact applications using Kryo4 elsewhere in their codebase.

afs avatar Sep 11 '25 07:09 afs

No rush - trying to get all the "bumps" done early in the 6. cycle,; this one is isolated so not getting in the way of anything outside of geosparql - can this merged now or are there other changes necessary?

afs avatar Oct 27 '25 14:10 afs

There are a couple of small QoL improvements that I should add to avoid confusion.

I think it is still possible to read the metadata (from kryo's perspective a plain string) of spatial indexes created with kryo4 using kryo5.

  • If so, then i can add a check whether the version field is 2.0.0 and raise an exception that this format is no longer supported. Deleting the spatial index file should re-create it on Fuseki start up.
  • I should use a different version value for kyro5 in the metadata, such as 3.0.0.

Aklakan avatar Oct 27 '25 14:10 Aklakan

I added the version check - with an old index it now outputs:

org.apache.jena.geosparql.spatial.SpatialIndexException: Spatial index version 2.0.0 is no longer supported.
Move or delete this file to allow for creation of a new index in its place: /foo/bar/spatial.index
	at org.apache.jena.geosparql.spatial.index.v2.SpatialIndexIoKryo.load(SpatialIndexIoKryo.java:219)

Aklakan avatar Oct 29 '25 10:10 Aklakan