public static class DeferredConstraintsMemory.CheckInfo extends DeferredConstraintsMemory.ValidationInfo
Modifier and Type | Field and Description |
---|---|
private java.util.List<UUID> |
culprits |
private boolean |
invalidatedDueToCompress |
private java.lang.String |
schemaName |
private java.lang.String |
tableName |
infoRows
Constructor and Description |
---|
CheckInfo(BackingStoreHashtable infoRows,
java.lang.String schemaName,
java.lang.String tableName,
java.util.List<UUID> culprits) |
Modifier and Type | Method and Description |
---|---|
void |
addCulprits(java.util.List<UUID> newCulprits) |
java.util.List<UUID> |
getCulprints() |
boolean |
isInvalidated() |
void |
possiblyValidateOnReturn(LanguageConnectionContext lcc,
SQLSessionContext nested,
SQLSessionContext caller) |
void |
setInvalidatedRowLocations() |
private void |
validateCheck(LanguageConnectionContext lcc,
UUID constraintId,
boolean rollbackOnError) |
void |
validateConstraint(LanguageConnectionContext lcc,
UUID constraintId,
boolean rollbackOnError)
Validate one or more CHECK constraints on a table.
|
private final java.lang.String schemaName
private final java.lang.String tableName
private java.util.List<UUID> culprits
private boolean invalidatedDueToCompress
public CheckInfo(BackingStoreHashtable infoRows, java.lang.String schemaName, java.lang.String tableName, java.util.List<UUID> culprits)
public void setInvalidatedRowLocations()
public boolean isInvalidated()
public void addCulprits(java.util.List<UUID> newCulprits)
public java.util.List<UUID> getCulprints()
public void possiblyValidateOnReturn(LanguageConnectionContext lcc, SQLSessionContext nested, SQLSessionContext caller) throws StandardException
possiblyValidateOnReturn
in class DeferredConstraintsMemory.ValidationInfo
StandardException
public final void validateConstraint(LanguageConnectionContext lcc, UUID constraintId, boolean rollbackOnError) throws StandardException
Implementation note: We remember violations for a row by storing its row location in a disk based hash table, similar to what we do for the index location for primary key and unique constraints. As far as which constraints caused which violations, constraints are only presently remembered as having caused "one or more violations", i.e. for any violating row, we do not know at checking time exactly which constraint caused a problem for that exact row. So, for any given constraint which was violated in the transaction we visit all rows which had one or more violations and check again. This could be improved upon by remembering for each violating row the exact set of constraint(s) that saw a violation. Still, this is much faster than a full table scan in most use cases. We use a special internal query option to achieve this. The row locations may not be usable if Derby does a compress or otherwise makes them invalid. In that case we resort to a full table scan.
validateConstraint
in class DeferredConstraintsMemory.ValidationInfo
lcc
- The language connection contextconstraintId
- If not null
, check only for this
constraint. This is used when switching mode to
immediate. If null
, we check all check
constraints, i.e. at commit or if we have SET CONSTRAINT ALL IMMEDIATE
.rollbackOnError
- If true
and a violation occurs, throw
and exception that will cause rollback.StandardException
- Default error policyValidateCheckConstraintResultSet
private void validateCheck(LanguageConnectionContext lcc, UUID constraintId, boolean rollbackOnError) throws StandardException
StandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.