[Checkins] SVN: relstorage/trunk/ - Added a state_size column to object_state, making it possible

Shane Hathaway shane at hathawaymix.org
Sat Feb 5 06:05:43 EST 2011


Log message for revision 120113:
  - Added a state_size column to object_state, making it possible
    to query the size of objects without loading the state.  The new
    column is intended for gathering statistics.  A schema migration
    is required.
  
  Also reverted the change to bigint unsigned in MySQL.  The conversion
  would cause unnecessary pain.  Perhaps a better idea is to either use
  negative numbers or disallow the upper bit in OIDs.
  
  

Changed:
  U   relstorage/trunk/CHANGES.txt
  U   relstorage/trunk/README.txt
  A   relstorage/trunk/notes/migrate-to-1.5.txt
  U   relstorage/trunk/relstorage/adapters/mover.py
  U   relstorage/trunk/relstorage/adapters/packundo.py
  U   relstorage/trunk/relstorage/adapters/schema.py

-=-
Modified: relstorage/trunk/CHANGES.txt
===================================================================
--- relstorage/trunk/CHANGES.txt	2011-02-05 10:11:46 UTC (rev 120112)
+++ relstorage/trunk/CHANGES.txt	2011-02-05 11:05:42 UTC (rev 120113)
@@ -2,6 +2,11 @@
 Next Release
 ------------
 
+- Added a state_size column to object_state, making it possible
+  to query the size of objects without loading the state.  The new
+  column is intended for gathering statistics.  A schema migration
+  is required.
+
 - Added more logging during zodbconvert to show that something is
   happening and give an indication of how far along the process is.
 

Modified: relstorage/trunk/README.txt
===================================================================
--- relstorage/trunk/README.txt	2011-02-05 10:11:46 UTC (rev 120112)
+++ relstorage/trunk/README.txt	2011-02-05 11:05:42 UTC (rev 120113)
@@ -309,17 +309,22 @@
 Sometimes RelStorage needs a schema modification along with a software
 upgrade.  Hopefully, this will not often be necessary.
 
-No schema migration is required if you are using PostgreSQL or MySQL
-and upgrading from version 1.1.2 or later.  See the `notes subdirectory`_
-if you are upgrading from an older version.
+Migration to RelStorage version 1.5 requires a schema upgrade.
+See `migrate-to-1.5.txt`_.
 
-.. _`notes subdirectory`: http://svn.zope.org/relstorage/trunk/notes/
+.. _`migrate-to-1.5.txt`: http://svn.zope.org/*checkout*/relstorage/trunk/notes/migrate-to-1.5.txt
 
-To migrate Oracle to version 1.4, see `migrate-to-1.4.txt`_.
+Migration to RelStorage version 1.4.2 requires a schema upgrade if
+you are using a history-free database (meaning keep-history is false).
+See `migrate-to-1.4.txt`_.
 
 .. _`migrate-to-1.4.txt`: http://svn.zope.org/*checkout*/relstorage/trunk/notes/migrate-to-1.4.txt
 
+See the `notes subdirectory`_ if you are upgrading from an older version.
 
+.. _`notes subdirectory`: http://svn.zope.org/relstorage/trunk/notes/
+
+
 RelStorage Options
 ==================
 
@@ -453,7 +458,9 @@
         of what to pack, but no data is actually removed.  After a dry run,
         the pack_object, pack_state, and pack_state_tid tables are filled
         with the list of object states and objects that would have been
-        removed.
+        removed.  The object_ref table will also be fully populated.
+        The object_ref table can be queried to discover references
+        between stored objects.
 
 ``pack-batch-timeout``
         Packing occurs in batches of transactions; this specifies the
@@ -628,6 +635,11 @@
     history-free storages, since unreferenced objects are not removed
     from the database until the specified number of days have passed.
 
+  ``--dry-run``
+    Instructs the storage to run a dry run of the pack but not actually
+    delete anything.  This is equivalent to specifying ``pack-dry-run true``
+    in the storage options.
+
 Development
 ===========
 

Added: relstorage/trunk/notes/migrate-to-1.5.txt
===================================================================
--- relstorage/trunk/notes/migrate-to-1.5.txt	                        (rev 0)
+++ relstorage/trunk/notes/migrate-to-1.5.txt	2011-02-05 11:05:42 UTC (rev 120113)
@@ -0,0 +1,45 @@
+
+Migrating to RelStorage version 1.5
+===================================
+
+All databases need a schema migration for this release.  This release
+adds a state_size column to the object_state table, making it possible
+to query the size of objects without loading the state.  The new column
+is intended for gathering statistics.
+
+Please note that if you are using the history-free schema, you need to
+first migrate to RelStorage 1.4.2 by following the instructions in
+migrate-to-1.4.txt.
+
+
+PostgreSQL
+----------
+
+    BEGIN;
+    ALTER TABLE object_state ADD COLUMN state_size BIGINT;
+    UPDATE object_state SET state_size = COALESCE(LENGTH(state), 0);
+    ALTER TABLE object_state ALTER COLUMN state_size SET NOT NULL;
+    COMMIT;
+
+
+MySQL history-preserving
+------------------------
+
+    ALTER TABLE object_state ADD COLUMN state_size BIGINT AFTER md5;
+    UPDATE object_state SET state_size = COALESCE(LENGTH(state), 0);
+    ALTER TABLE object_state MODIFY state_size BIGINT NOT NULL AFTER md5;
+
+MySQL history-free
+------------------
+
+    ALTER TABLE object_state ADD COLUMN state_size BIGINT AFTER tid;
+    UPDATE object_state SET state_size = COALESCE(LENGTH(state), 0);
+    ALTER TABLE object_state MODIFY state_size BIGINT NOT NULL AFTER tid;
+
+
+Oracle
+------
+
+    ALTER TABLE object_state ADD state_size NUMBER(20);
+    UPDATE object_state SET state_size = COALESCE(LENGTH(state), 0);
+    ALTER TABLE object_state MODIFY state_size NOT NULL;

Modified: relstorage/trunk/relstorage/adapters/mover.py
===================================================================
--- relstorage/trunk/relstorage/adapters/mover.py	2011-02-05 10:11:46 UTC (rev 120112)
+++ relstorage/trunk/relstorage/adapters/mover.py	2011-02-05 11:05:42 UTC (rev 120113)
@@ -57,7 +57,7 @@
         'update_current',
         'download_blob',
         'upload_blob',
-        )
+    )
 
     def __init__(self, database_name, options, runner=None,
             Binary=None, inputsizes=None, version_detector=None):
@@ -458,7 +458,7 @@
             (oid, prev_tid, md5sum, encodestring(data)),
             rowkey=oid,
             size=len(data),
-            )
+        )
 
     def mysql_store_temp(self, cursor, batcher, oid, prev_tid, data):
         """Store an object in the temporary table."""
@@ -473,7 +473,7 @@
             rowkey=oid,
             size=len(data),
             command='REPLACE',
-            )
+        )
 
     def oracle_store_temp(self, cursor, batcher, oid, prev_tid, data):
         """Store an object in the temporary table."""
@@ -482,17 +482,18 @@
         else:
             md5sum = None
 
-        if len(data) <= 2000:
+        size = len(data)
+        if size <= 2000:
             # Send data inline for speed.  Oracle docs say maximum size
             # of a RAW is 2000 bytes.
-            stmt = "BEGIN relstorage_op.store_temp(:1, :2, :3, :4); END;"
+            stmt = "BEGIN relstorage_op.store_temp(:1, :2, :3, :5); END;"
             batcher.add_array_op(
                 stmt,
                 'oid prev_tid md5sum rawdata',
                 (oid, prev_tid, md5sum, data),
                 rowkey=oid,
-                size=len(data),
-                )
+                size=size,
+            )
         else:
             # Send data as a BLOB
             row = {
@@ -500,14 +501,14 @@
                 'prev_tid': prev_tid,
                 'md5sum': md5sum,
                 'blobdata': data,
-                }
+            }
             batcher.insert_into(
                 "temp_store (zoid, prev_tid, md5, state)",
                 ":oid, :prev_tid, :md5sum, :blobdata",
                 row,
                 rowkey=oid,
-                size=len(data),
-                )
+                size=size,
+            )
 
 
 
@@ -524,33 +525,35 @@
 
         if data is not None:
             encoded = encodestring(data)
+            size = len(data)
         else:
             encoded = None
+            size = 0
 
         if self.keep_history:
             batcher.delete_from("object_state", zoid=oid, tid=tid)
             row_schema = """
                 %s, %s,
                 COALESCE((SELECT tid FROM current_object WHERE zoid = %s), 0),
-                %s, decode(%s, 'base64')
+                %s, %s, decode(%s, 'base64')
             """
             batcher.insert_into(
-                "object_state (zoid, tid, prev_tid, md5, state)",
+                "object_state (zoid, tid, prev_tid, md5, state_size, state)",
                 row_schema,
-                (oid, tid, oid, md5sum, encoded),
+                (oid, tid, oid, md5sum, size, encoded),
                 rowkey=(oid, tid),
-                size=len(data or ''),
-                )
+                size=size,
+            )
         else:
             batcher.delete_from('object_state', zoid=oid)
             if data:
                 batcher.insert_into(
-                    "object_state (zoid, tid, state)",
-                    "%s, %s, decode(%s, 'base64')",
-                    (oid, tid, encoded),
+                    "object_state (zoid, tid, state_size, state)",
+                    "%s, %s, %s, decode(%s, 'base64')",
+                    (oid, tid, size, encoded),
                     rowkey=oid,
-                    size=len(data),
-                    )
+                    size=size,
+                )
 
     def mysql_restore(self, cursor, batcher, oid, tid, data):
         """Store an object directly, without conflict detection.
@@ -564,33 +567,35 @@
 
         if data is not None:
             encoded = self.Binary(data)
+            size = len(data)
         else:
             encoded = None
+            size = 0
 
         if self.keep_history:
             row_schema = """
                 %s, %s,
                 COALESCE((SELECT tid FROM current_object WHERE zoid = %s), 0),
-                %s, %s
+                %s, %s, %s
             """
             batcher.insert_into(
-                "object_state (zoid, tid, prev_tid, md5, state)",
+                "object_state (zoid, tid, prev_tid, md5, state_size, state)",
                 row_schema,
-                (oid, tid, oid, md5sum, encoded),
+                (oid, tid, oid, md5sum, size, encoded),
                 rowkey=(oid, tid),
-                size=len(data or ''),
+                size=size,
                 command='REPLACE',
-                )
+            )
         else:
             if data:
                 batcher.insert_into(
-                    "object_state (zoid, tid, state)",
-                    "%s, %s, %s",
-                    (oid, tid, encoded),
+                    "object_state (zoid, tid, state_size, state)",
+                    "%s, %s, %s, %s",
+                    (oid, tid, size, encoded),
                     rowkey=oid,
-                    size=len(data),
+                    size=size,
                     command='REPLACE',
-                    )
+                )
             else:
                 batcher.delete_from('object_state', zoid=oid)
 
@@ -604,7 +609,12 @@
         else:
             md5sum = None
 
-        if not data or len(data) <= 2000:
+        if data is not None:
+            size = len(data)
+        else:
+            size = 0
+
+        if size <= 2000:
             # Send data inline for speed.  Oracle docs say maximum size
             # of a RAW is 2000 bytes.
             if self.keep_history:
@@ -614,8 +624,8 @@
                     'oid tid md5sum rawdata',
                     (oid, tid, md5sum, data),
                     rowkey=(oid, tid),
-                    size=len(data or ''),
-                    )
+                    size=size,
+                )
             else:
                 stmt = "BEGIN relstorage_op.restore(:1, :2, :3); END;"
                 batcher.add_array_op(
@@ -623,8 +633,8 @@
                     'oid tid rawdata',
                     (oid, tid, data),
                     rowkey=(oid, tid),
-                    size=len(data or ''),
-                    )
+                    size=size,
+                )
 
         else:
             # Send as a BLOB
@@ -633,32 +643,39 @@
                     'oid': oid,
                     'tid': tid,
                     'md5sum': md5sum,
+                    'state_size': size,
                     'blobdata': data,
-                    }
+                }
                 row_schema = """
                     :oid, :tid,
                     COALESCE((SELECT tid
                               FROM current_object
                               WHERE zoid = :oid), 0),
-                    :md5sum, :blobdata
+                    :md5sum, :state_size, :blobdata
                 """
                 batcher.insert_into(
-                    "object_state (zoid, tid, prev_tid, md5, state)",
+                    "object_state (zoid, tid, prev_tid, md5, state_size, state)",
                     row_schema,
                     row,
                     rowkey=(oid, tid),
-                    size=len(data or ''),
-                    )
+                    size=size,
+                )
             else:
                 batcher.delete_from('object_state', zoid=oid)
                 if data:
+                    row = {
+                        'oid': oid,
+                        'tid': tid,
+                        'state_size': size,
+                        'blobdata': data,
+                    }
                     batcher.insert_into(
-                        "object_state (zoid, tid, state)",
-                        ":oid, :tid, :blobdata",
-                        {'oid': oid, 'tid': tid, 'blobdata': data},
+                        "object_state (zoid, tid, state_size, state)",
+                        ":oid, :tid, :state_size, :blobdata",
+                        row,
                         rowkey=oid,
-                        size=len(data),
-                        )
+                        size=size,
+                    )
 
 
 
@@ -819,14 +836,18 @@
         if self.keep_history:
             if self.database_name == 'oracle':
                 stmt = """
-                INSERT INTO object_state (zoid, tid, prev_tid, md5, state)
-                SELECT zoid, :1, prev_tid, md5, state
+                INSERT INTO object_state
+                    (zoid, tid, prev_tid, md5, state_size, state)
+                SELECT zoid, :1, prev_tid, md5,
+                    COALESCE(LENGTH(state), 0), state
                 FROM temp_store
                 """
             else:
                 stmt = """
-                INSERT INTO object_state (zoid, tid, prev_tid, md5, state)
-                SELECT zoid, %s, prev_tid, md5, state
+                INSERT INTO object_state
+                    (zoid, tid, prev_tid, md5, state_size, state)
+                SELECT zoid, %s, prev_tid, md5,
+                    COALESCE(LENGTH(state), 0), state
                 FROM temp_store
                 """
             cursor.execute(stmt, (tid,))
@@ -834,8 +855,8 @@
         else:
             if self.database_name == 'mysql':
                 stmt = """
-                REPLACE INTO object_state (zoid, tid, state)
-                SELECT zoid, %s, state
+                REPLACE INTO object_state (zoid, tid, state_size, state)
+                SELECT zoid, %s, COALESCE(LENGTH(state), 0), state
                 FROM temp_store
                 """
                 cursor.execute(stmt, (tid,))
@@ -849,14 +870,14 @@
 
                 if self.database_name == 'oracle':
                     stmt = """
-                    INSERT INTO object_state (zoid, tid, state)
-                    SELECT zoid, :1, state
+                    INSERT INTO object_state (zoid, tid, state_size, state)
+                    SELECT zoid, :1, COALESCE(LENGTH(state), 0), state
                     FROM temp_store
                     """
                 else:
                     stmt = """
-                    INSERT INTO object_state (zoid, tid, state)
-                    SELECT zoid, %s, state
+                    INSERT INTO object_state (zoid, tid, state_size, state)
+                    SELECT zoid, %s, COALESCE(LENGTH(state), 0), state
                     FROM temp_store
                     """
                 cursor.execute(stmt, (tid,))

Modified: relstorage/trunk/relstorage/adapters/packundo.py
===================================================================
--- relstorage/trunk/relstorage/adapters/packundo.py	2011-02-05 10:11:46 UTC (rev 120112)
+++ relstorage/trunk/relstorage/adapters/packundo.py	2011-02-05 11:05:42 UTC (rev 120113)
@@ -316,9 +316,9 @@
             AND tid = %(self_tid)s;
 
         -- Copy old states forward.
-        INSERT INTO object_state (zoid, tid, prev_tid, md5, state)
+        INSERT INTO object_state (zoid, tid, prev_tid, md5, state_size, state)
         SELECT temp_undo.zoid, %(self_tid)s, current_object.tid,
-            md5, state
+            md5, COALESCE(state_size, 0), state
         FROM temp_undo
             JOIN current_object ON (temp_undo.zoid = current_object.zoid)
             LEFT JOIN object_state

Modified: relstorage/trunk/relstorage/adapters/schema.py
===================================================================
--- relstorage/trunk/relstorage/adapters/schema.py	2011-02-05 10:11:46 UTC (rev 120112)
+++ relstorage/trunk/relstorage/adapters/schema.py	2011-02-05 11:05:42 UTC (rev 120113)
@@ -19,7 +19,7 @@
 from zope.interface import implements
 import re
 
-relstorage_op_version = '1.5'
+relstorage_op_version = '1.5a'
 log = logging.getLogger("relstorage")
 
 history_preserving_schema = """
@@ -50,7 +50,7 @@
 
     mysql:
         CREATE TABLE transaction (
-            tid         BIGINT UNSIGNED NOT NULL PRIMARY KEY,
+            tid         BIGINT NOT NULL PRIMARY KEY,
             packed      BOOLEAN NOT NULL DEFAULT FALSE,
             empty       BOOLEAN NOT NULL DEFAULT FALSE,
             username    BLOB NOT NULL,
@@ -75,7 +75,7 @@
 
     mysql:
         CREATE TABLE new_oid (
-            zoid        BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
+            zoid        BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT
         ) ENGINE = MyISAM;
 
     oracle:
@@ -93,6 +93,7 @@
                         PRIMARY KEY (zoid, tid),
             prev_tid    BIGINT NOT NULL REFERENCES transaction,
             md5         CHAR(32),
+            state_size  BIGINT NOT NULL CHECK (state_size >= 0),
             state       BYTEA
         );
         CREATE INDEX object_state_tid ON object_state (tid);
@@ -113,21 +114,22 @@
 
     mysql:
         CREATE TABLE object_state (
-            zoid        BIGINT UNSIGNED NOT NULL,
-            tid         BIGINT UNSIGNED NOT NULL REFERENCES transaction,
+            zoid        BIGINT NOT NULL,
+            tid         BIGINT NOT NULL REFERENCES transaction,
                         PRIMARY KEY (zoid, tid),
                         CHECK (tid > 0),
-            prev_tid    BIGINT UNSIGNED NOT NULL REFERENCES transaction,
+            prev_tid    BIGINT NOT NULL REFERENCES transaction,
             md5         CHAR(32) CHARACTER SET ascii,
+            state_size  BIGINT NOT NULL,
             state       LONGBLOB
         ) ENGINE = InnoDB;
         CREATE INDEX object_state_tid ON object_state (tid);
         CREATE INDEX object_state_prev_tid ON object_state (prev_tid);
 
         CREATE TABLE blob_chunk (
-            zoid        BIGINT UNSIGNED NOT NULL,
-            tid         BIGINT UNSIGNED NOT NULL,
-            chunk_num   BIGINT UNSIGNED NOT NULL,
+            zoid        BIGINT NOT NULL,
+            tid         BIGINT NOT NULL,
+            chunk_num   BIGINT NOT NULL,
                         PRIMARY KEY (zoid, tid, chunk_num),
             chunk       LONGBLOB NOT NULL
         ) ENGINE = InnoDB;
@@ -145,6 +147,8 @@
                         CONSTRAINT tid_min CHECK (tid > 0),
             prev_tid    NUMBER(20) NOT NULL REFERENCES transaction,
             md5         CHAR(32),
+            state_size  NUMBER(20) NOT NULL,
+                        CONSTRAINT state_size_min CHECK (state_size >= 0),
             state       BLOB
         );
         CREATE INDEX object_state_tid ON object_state (tid);
@@ -176,8 +180,8 @@
 
     mysql:
         CREATE TABLE current_object (
-            zoid        BIGINT UNSIGNED NOT NULL PRIMARY KEY,
-            tid         BIGINT UNSIGNED NOT NULL,
+            zoid        BIGINT NOT NULL PRIMARY KEY,
+            tid         BIGINT NOT NULL,
                         FOREIGN KEY (zoid, tid)
                             REFERENCES object_state (zoid, tid)
         ) ENGINE = InnoDB;
@@ -208,9 +212,9 @@
 
     mysql:
         CREATE TABLE object_ref (
-            zoid        BIGINT UNSIGNED NOT NULL,
-            tid         BIGINT UNSIGNED NOT NULL,
-            to_zoid     BIGINT UNSIGNED NOT NULL,
+            zoid        BIGINT NOT NULL,
+            tid         BIGINT NOT NULL,
+            to_zoid     BIGINT NOT NULL,
             PRIMARY KEY (tid, zoid, to_zoid)
         ) ENGINE = MyISAM;
 
@@ -236,7 +240,7 @@
 
     mysql:
         CREATE TABLE object_refs_added (
-            tid         BIGINT UNSIGNED NOT NULL PRIMARY KEY
+            tid         BIGINT NOT NULL PRIMARY KEY
         ) ENGINE = MyISAM;
 
     oracle:
@@ -265,9 +269,9 @@
 
     mysql:
         CREATE TABLE pack_object (
-            zoid        BIGINT UNSIGNED NOT NULL PRIMARY KEY,
+            zoid        BIGINT NOT NULL PRIMARY KEY,
             keep        BOOLEAN NOT NULL,
-            keep_tid    BIGINT UNSIGNED NOT NULL,
+            keep_tid    BIGINT NOT NULL,
             visited     BOOLEAN NOT NULL DEFAULT FALSE
         ) ENGINE = MyISAM;
         CREATE INDEX pack_object_keep_zoid ON pack_object (keep, zoid);
@@ -293,8 +297,8 @@
 
     mysql:
         CREATE TABLE pack_state (
-            tid         BIGINT UNSIGNED NOT NULL,
-            zoid        BIGINT UNSIGNED NOT NULL,
+            tid         BIGINT NOT NULL,
+            zoid        BIGINT NOT NULL,
             PRIMARY KEY (tid, zoid)
         ) ENGINE = MyISAM;
 
@@ -315,7 +319,7 @@
 
     mysql:
         CREATE TABLE pack_state_tid (
-            tid         BIGINT UNSIGNED NOT NULL PRIMARY KEY
+            tid         BIGINT NOT NULL PRIMARY KEY
         ) ENGINE = MyISAM;
 
     oracle:
@@ -332,6 +336,7 @@
             zoid        NUMBER(20) NOT NULL PRIMARY KEY,
             prev_tid    NUMBER(20) NOT NULL,
             md5         CHAR(32),
+            state_size  NUMBER(20) NOT NULL,
             state       BLOB,
             blobdata    BLOB
         ) ON COMMIT DELETE ROWS;
@@ -434,12 +439,13 @@
             WHERE zoid = zoids(indx)
                 AND tid = tids(indx);
         FORALL indx IN zoids.first..zoids.last
-            INSERT INTO object_state (zoid, tid, prev_tid, md5, state) VALUES
-            (zoids(indx), tids(indx),
-            COALESCE((SELECT tid
-                      FROM current_object
-                      WHERE zoid = zoids(indx)), 0),
-            md5s(indx), states(indx));
+            INSERT INTO object_state
+                (zoid, tid, prev_tid, md5, state_size, state)
+                VALUES (zoids(indx), tids(indx),
+                    COALESCE((SELECT tid
+                        FROM current_object
+                        WHERE zoid = zoids(indx)), 0),
+                md5s(indx), COALESCE(LENGTH(states(indx)), 0), states(indx));
     END restore;
 END relstorage_op;
 /
@@ -467,7 +473,7 @@
 
     mysql:
         CREATE TABLE new_oid (
-            zoid        BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
+            zoid        BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT
         ) ENGINE = MyISAM;
 
     oracle:
@@ -479,6 +485,7 @@
         CREATE TABLE object_state (
             zoid        BIGINT NOT NULL PRIMARY KEY,
             tid         BIGINT NOT NULL CHECK (tid > 0),
+            state_size  BIGINT NOT NULL CHECK (state_size >= 0),
             state       BYTEA
         );
         CREATE INDEX object_state_tid ON object_state (tid);
@@ -498,18 +505,19 @@
 
     mysql:
         CREATE TABLE object_state (
-            zoid        BIGINT UNSIGNED NOT NULL PRIMARY KEY,
-            tid         BIGINT UNSIGNED NOT NULL,
+            zoid        BIGINT NOT NULL PRIMARY KEY,
+            tid         BIGINT NOT NULL,
                         CHECK (tid > 0),
+            state_size  BIGINT NOT NULL,
             state       LONGBLOB
         ) ENGINE = InnoDB;
         CREATE INDEX object_state_tid ON object_state (tid);
 
         CREATE TABLE blob_chunk (
-            zoid        BIGINT UNSIGNED NOT NULL,
-            chunk_num   BIGINT UNSIGNED NOT NULL,
+            zoid        BIGINT NOT NULL,
+            chunk_num   BIGINT NOT NULL,
                         PRIMARY KEY (zoid, chunk_num),
-            tid         BIGINT UNSIGNED NOT NULL,
+            tid         BIGINT NOT NULL,
             chunk       LONGBLOB NOT NULL
         ) ENGINE = InnoDB;
         CREATE INDEX blob_chunk_lookup ON blob_chunk (zoid);
@@ -523,6 +531,8 @@
             zoid        NUMBER(20) NOT NULL PRIMARY KEY,
             tid         NUMBER(20) NOT NULL,
                         CONSTRAINT tid_min CHECK (tid > 0),
+            state_size  NUMBER(20) NOT NULL,
+                        CONSTRAINT state_size_min CHECK (state_size >= 0),
             state       BLOB
         );
         CREATE INDEX object_state_tid ON object_state (tid);
@@ -553,9 +563,9 @@
 
     mysql:
         CREATE TABLE object_ref (
-            zoid        BIGINT UNSIGNED NOT NULL,
-            to_zoid     BIGINT UNSIGNED NOT NULL,
-            tid         BIGINT UNSIGNED NOT NULL,
+            zoid        BIGINT NOT NULL,
+            to_zoid     BIGINT NOT NULL,
+            tid         BIGINT NOT NULL,
             PRIMARY KEY (zoid, to_zoid)
         ) ENGINE = MyISAM;
 
@@ -578,8 +588,8 @@
 
     mysql:
         CREATE TABLE object_refs_added (
-            zoid        BIGINT UNSIGNED NOT NULL PRIMARY KEY,
-            tid         BIGINT UNSIGNED NOT NULL
+            zoid        BIGINT NOT NULL PRIMARY KEY,
+            tid         BIGINT NOT NULL
         ) ENGINE = MyISAM;
 
     oracle:
@@ -608,9 +618,9 @@
 
     mysql:
         CREATE TABLE pack_object (
-            zoid        BIGINT UNSIGNED NOT NULL PRIMARY KEY,
+            zoid        BIGINT NOT NULL PRIMARY KEY,
             keep        BOOLEAN NOT NULL,
-            keep_tid    BIGINT UNSIGNED NOT NULL,
+            keep_tid    BIGINT NOT NULL,
             visited     BOOLEAN NOT NULL DEFAULT FALSE
         ) ENGINE = MyISAM;
         CREATE INDEX pack_object_keep_zoid ON pack_object (keep, zoid);



More information about the checkins mailing list