-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-5148 Introduce "soft fail" for corrupt ValueStore #5150
GH-5148 Introduce "soft fail" for corrupt ValueStore #5150
Conversation
@@ -534,7 +555,10 @@ private NativeValue data2value(int id, byte[] data) throws IOException { | |||
case LITERAL_VALUE: | |||
return data2literal(id, data); | |||
default: | |||
throw new IllegalArgumentException("Invalid type " + data[0] + " for value with id " + id); | |||
if (softFailOnCorruptData) { | |||
return new CorruptValue(revision, id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could potentially include data[0] at this point.
@@ -0,0 +1,91 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2024 Eclipse RDF4J contributors, Aduna, and others. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an old copyright header. See https://github.com/eclipse-rdf4j/rdf4j/blob/main/CONTRIBUTING.md#code-formatting
core/sail/nativerdf/src/main/java/org/eclipse/rdf4j/sail/nativerdf/model/CorruptValue.java
Show resolved
Hide resolved
Any chance you would be interested in adding some info about this to our documentation? I'm not sure where, but maybe at the end of the NativeStore section here:
Could we also try to create a test? Maybe create a NativeStore, add data, verify that the data is there. Do a shutdown() and then modify the files on disk to make them corrupted. Then init() the store again and try to read the data. |
34807e1
into
eclipse-rdf4j:GH-5148-soft-fail-native-store
GitHub issue resolved: #5148
Briefly describe the changes proposed in this PR:
ValueStore.data2value()
with SailException (previously it was possible to get anArrayIndexOutOfBoundsException
andIllegalArgumentException
).org.eclipse.rdf4j.sail.nativerdf.softFailOnCorruptData
to enable "soft failure mode" and to avoid exceptions as described above. Instead, an instance of the newly introduced CorruptValue will be returned.RepositoryConnection
would be forcefully closed when hitting the first corrupted value.PR Author Checklist (see the contributor guidelines for more details):
mvn process-resources
to format from the command line)