Check-in [74854a30b8]
Not logged in
Overview

SHA1 Hash:74854a30b8b4cc44a19fc8e305768fac8c536a14
Date: 2007-12-02 03:40:56
User: aku
Comment:Added ability to declare indices on tables in the persistent state. Used this to declare indices on critical columns. Slows down the transactions saving changesets, this however is made up when it comes to successor/predecessor retrieval of changesets.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_pcollrev.tcl from [531ee2ff11] to [e100446c46].

@@ -174,11 +174,13 @@
 	    fid  INTEGER  NOT NULL  REFERENCES file,     -- File the item belongs to
 	    lod  INTEGER            REFERENCES symbol,   -- Line of development (NULL => Trunk)
 	    sid  INTEGER  NOT NULL  REFERENCES symbol,   -- Symbol capturing the tag
 
 	    rev  INTEGER  NOT NULL  REFERENCES revision  -- The revision being tagged.
-	}
+	} { rev sid }
+	# Indices on: rev (revision successors)
+	#             sid (tag predecessors, branch successors/predecessors)
 
 	state writing branch {
 	    bid   INTEGER  NOT NULL  PRIMARY KEY AUTOINCREMENT,
 	    fid   INTEGER  NOT NULL  REFERENCES file,     -- File the item belongs to
 	    lod   INTEGER            REFERENCES symbol,   -- Line of development (NULL => Trunk)
@@ -193,11 +195,14 @@
             -- only revision on trunk is the unnecessary dead one the
             -- branch was sprouted from and it has commits. The branch
             -- will exist to be the LOD of its revisions, nothing to
             -- sprout from, the dead revision was removed, hence no
             -- root.
-	}
+	} { root first sid }
+	# Indices on: root  (revision successors)
+	#             first (revision predecessors)
+	#             sid   (tag predecessors, branch successors/predecessors)
 
 	# Project level ...
 	#	pLineOfDevelopment, pSymbol, pBranch, pTag, pTrunk
 	#
 	#	pTrunk  <- pLineOfDevelopment

Modified tools/cvs2fossil/lib/c2f_pcollsym.tcl from [0ef91b21f1] to [47871c6aa2].

@@ -55,11 +55,12 @@
 	    -- forest in case of multiple projects, with one tree per
 	    -- project.
 
 	    sid INTEGER  NOT NULL  PRIMARY KEY  REFERENCES symbol,
 	    pid INTEGER  NOT NULL               REFERENCES symbol
-	}
+	} { pid }
+	# Index on: pid (branch successors`)
 	return
     }
 
     typemethod load {} {
 	# Pass manager interface. Executed to load data computed by

Modified tools/cvs2fossil/lib/c2f_state.tcl from [fe7e766e18] to [e4b4a90ad7].

@@ -93,20 +93,28 @@
 	if {$mypath eq ""} return
 	file delete $mypath
 	return
     }
 
-    typemethod writing {name definition} {
+    typemethod writing {name definition {indices {}}} {
 	# Method for a user to declare a table its needs for storing
 	# persistent state, and the expected structure. A possibly
 	# previously existing definition is dropped.
 
 	log write 1 state "writing $name" ; # TODO move to level 5 or so
 
 	$mystate transaction {
 	    catch { $mystate eval "DROP TABLE $name" }
 	    $mystate eval "CREATE TABLE $name ( $definition )"
+
+	    set id 0
+	    foreach columns $indices {
+		log write 1 state "index   $name$id" ; # TODO move to level 5 or so
+
+		$mystate eval "CREATE INDEX ${name}$id ON ${name} ( [join $columns ,] )"
+		incr id
+	    }
 	}
 	return
     }
 
     typemethod reading {name} {