Class DeferredConstraintsMemory.CheckInfo

    • Field Detail

      • schemaName

        private final java.lang.String schemaName
      • tableName

        private final java.lang.String tableName
      • culprits

        private java.util.List<UUID> culprits
      • invalidatedDueToCompress

        private boolean invalidatedDueToCompress
    • Constructor Detail

      • CheckInfo

        public CheckInfo​(BackingStoreHashtable infoRows,
                         java.lang.String schemaName,
                         java.lang.String tableName,
                         java.util.List<UUID> culprits)
    • Method Detail

      • setInvalidatedRowLocations

        public void setInvalidatedRowLocations()
      • isInvalidated

        public boolean isInvalidated()
      • addCulprits

        public void addCulprits​(java.util.List<UUID> newCulprits)
      • getCulprints

        public java.util.List<UUID> getCulprints()
      • validateConstraint

        public final void validateConstraint​(LanguageConnectionContext lcc,
                                             UUID constraintId,
                                             boolean rollbackOnError)
                                      throws StandardException
        Validate one or more CHECK constraints on a table.

        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.

        Specified by:
        validateConstraint in class DeferredConstraintsMemory.ValidationInfo
        Parameters:
        lcc - The language connection context
        constraintId - 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.
        Throws:
        StandardException - Default error policy
        See Also:
        ValidateCheckConstraintResultSet