Repository navigation
Description
Summary
AbstractProperty's constraint flags are written by ALTER PROPERTY and read lock free by
DocumentValidator on every write, with no safe publication. Two members of that same class already
carry volatile for exactly this argument, which is what makes the omission visible rather than
debatable.
protected Map<String, Object> custom = new HashMap<>(); // :39
protected boolean readonly = false; // :40
protected boolean mandatory = false; // :41
protected boolean notNull = false; // :42
protected boolean hidden = false; // :43
protected volatile boolean external = false; // :49 <-- volatile
protected String compression = null; // :55
protected String max = null; // :56
protected String min = null; // :57
protected String regexp = null; // :58
protected String ofType = null; // :59
protected volatile DefaultValue defaultValue = DefaultValue.NOT_SET; // :65 <-- volatileA thread executing an insert can therefore validate against a stale notNull, mandatory, min,
max or regexp after another thread has altered the property, with no happens before edge between
the two.
The sweep that should have caught it
#7033 declared the copy on write family, documented it, grew it to six members and, unusually and
commendably, enforced it with a reflective sweep test that fails on any non final, non volatile
member. That is the one fix in its batch that expressed a rule rather than patching a case.
The sweep stops at LocalDocumentType and does not descend to AbstractProperty. It also accepts
final as a proxy for "immutable or concurrent", which is why the custom map survives it: the field
is a plain HashMap, one field away from the map #6799 made concurrent for the very same
toJSON() after unlock reason.
Suggested fix and the guarantee
Mark the constraint flags volatile, as external and defaultValue already are, and make custom
concurrent as #6799 did for its neighbour.
The guarantee already exists and only needs widening: extend #7033's reflective sweep to
AbstractProperty and tighten its final acceptance so that a final field of a non concurrent
mutable type does not pass. Without the second half, a final HashMap keeps satisfying the test while
being exactly the thing the test exists to prevent.
Scope
Verified at 8564d3ad79. Static argument: no race is demonstrated here, since a missing happens before
edge is not reliably reproducible, but the inconsistency within one class is on the lines above.
Activity
fix(#9989,#9990): custom values copy-on-write on types and properties…
fix(#9989): the refusal quotes the pattern it matched (review)
Merge pull request #10011 from ArcadeData/fix/9990-9991-9976-9989-999…
lvca commentedon Oct 14, 2026
Fixed in #10011 (release 26.11.1).
Property constraints (MANDATORY, NOTNULL, READONLY, MIN, MAX, REGEXP, custom values...) changed with
ALTER PROPERTYare now always seen right away by writes running at the same time. The automated check that guards this now covers properties too, and it found and fixed a few more schema structures with the same problem. As a bonus, a REGEXP is no longer recompiled on every write.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(ArcadeData#9990,ArcadeData#9991,ArcadeData#9976,ArcadeData#9989,A…
fix(#9990,#9991,#9976,#9989,#9992): one authority decides which REGEX…
fix(#9989,#9990): custom values copy-on-write on types and properties…
fix(#9989): the refusal quotes the pattern it matched (review)