[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Adding CHECK to NODES?

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Fri, 01 Mar 2013 10:15:10 +0000

philip_at_apache.org writes:

> Author: philip
> Date: Fri Mar 1 10:02:20 2013
> New Revision: 1451549
>
> URL: http://svn.apache.org/r1451549
> Log:
> Store NULL rather than 0 when not setting NODES.moved_here TRUE.
>
> * subversion/libsvn_wc/wc_db.c
> (insert_working_node, db_op_copy_shadowed_layer): Only bind
> moved_here if set.

NODES.moved_here is an SQLite INTEGER used as a boolean. Most of the
code uses 1 to indicate moved here and NULL to indicate not moved here.
There were a few places that were setting moved_here to 0, I have now
removed those.

I tracked down the places that need to be changed by temporarily adding:

  CHECK (moved_here IS NULL OR moved_here = 1)

to the NODES table definition in wc-metadata.sql. I imagine there is a
cost associated which such a check but it is probably small. Should we
add checks like this permanently? Should we attempt to benchmark the
cost? I guess the cost is only on INSERT/REPLACE/UPDATE and not on
SELECT? Are there other columns that should have CHECKs?

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download
Received on 2013-03-01 11:16:01 CET

This is an archived mail posted to the Subversion Dev mailing list.