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

Re: Node origins cache rewrite

From: David Glasser <glasser_at_davidglasser.net>
Date: Mon, 28 Jan 2008 09:55:34 -0800

On Jan 25, 2008 12:50 PM, David Glasser <glasser_at_davidglasser.net> wrote:
> On Jan 25, 2008 11:16 AM, David Glasser <glasser_at_davidglasser.net> wrote:
> > On Jan 24, 2008 6:54 PM, Mark Phippard <markphip_at_gmail.com> wrote:
> > > I see David has rewritten this to no longer use SQLite. Yay!
> >
> > Here's an alternative implementation. In FSFS, at commit time, new
> > node IDs are rewritten from a temporary value like "_ab3" to a unique
> > value by adding "ab3" to the "start_node_id" field in the current
> > file. This makes them not only unique, but also part of an ordered
> > sequence without gaps.
> >
> > Is it actually important that node IDs be ordered and gapless? We
> > could just change new node-IDs (in format 3 repositories) to be built
> > as "<rev>-ab3". get-node-origin-rev would be trivial on these nodes.
> > Pre-format-3 repositories, or nodes in format 3 repositories that
> > aren't dumped and loaded, would require the slow crawl.
>
> Like this. Can somebody review?

New version, supporting "svnadmin recover". Barring objections, will
commit later today.

[[[
In FSFS, instead of having a node-origin cache on disk, just change
the node-id to contain the node-origin-rev.

That is, instead of (at commit finalization time) rewriting node IDs
based on a node ID counter in the "current" file, rewrite them as
"<base36>-<rev>". Do the same for copy IDs, for consistency. Do this
only in Format 3.

Now svn_fs_node_origin_rev is a trivial "look in the node ID"
operation, unless you're in Format 2 or a repository sneakily upgraded
without a dump and load (not really supported anyway), in which case
you still do the history walk.

* subversion/libsvn_fs_fs/fs.h
  (PATH_NODE_ORIGINS_DIR): Remove.
  (SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT): New.

* subversion/libsvn_fs_fs/fs_fs.c
  (path_node_origin): Remove.
  (svn_fs_fs__hotcopy): Don't copy node origins cache.
  (write_final_rev): Depending on FS format, make new IDs either from
   revnum or from counter. Remove node_origins hash parameter.
  (write_current, write_final_current): Only write out node/copy IDs
   for old formats.
  (struct commit_baton): Remove node_origins hash.
  (commit_body): Only read in node/copy IDs for old formats. Don't
   pass node_origins hash to write_final_rev.
  (svn_fs_fs__commit): Remove post-commit node origins cache update.
  (svn_fs_fs__create): Don't write initial values of node/copy ID
   counters for new file format.
  (recover_body): Only calculate maximum node/copy IDs in the
   repository for old formats.
  (svn_fs_fs__ensure_dir_exists): Move back to lock.c (where it was
   before r29018).
  (svn_fs_fs__get_node_origin, set_node_origin,
   svn_fs_fs__set_node_origins, svn_fs_fs__set_node_origin): Remove.

* subversion/libsvn_fs_fs/fs_fs.h
  (svn_fs_fs__ensure_dir_exists, svn_fs_fs__set_node_origin,
   svn_fs_fs__set_node_origins, svn_fs_fs__get_node_origin): Remove.

* subversion/libsvn_fs_fs/lock.c
  (ensure_dir_exists): Move this back here (reverting r29018).
  (write_digest_file): Adjust.

* subversion/libsvn_fs_fs/structure
  Remove references to node origin cache. Describe new node-ID
  structure.

* subversion/libsvn_fs_fs/tree.c
  (fs_node_origin_rev): Remove use of cache. If the node-ID contains
   a '-', return the number after it.
]]]

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-01-28 18:55:48 CET

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