You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/01/06 19:29:18 UTC

svn commit: r896603 - /subversion/branches/fs-successor-ids/subversion/libsvn_fs_base/bdb/successors-table.c

Author: cmpilato
Date: Wed Jan  6 18:29:18 2010
New Revision: 896603

URL: http://svn.apache.org/viewvc?rev=896603&view=rev
Log:
On the 'fs-successor-ids' branch, use a smarter BDB API to avoid extra
work.

* subversion/libsvn_fs_base/bdb/successors-table.c
  (svn_fs_bdb__successors_delete): Position the cursor directly at the
    key/value pair we're looking for instead of interating to find it.

Modified:
    subversion/branches/fs-successor-ids/subversion/libsvn_fs_base/bdb/successors-table.c

Modified: subversion/branches/fs-successor-ids/subversion/libsvn_fs_base/bdb/successors-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/fs-successor-ids/subversion/libsvn_fs_base/bdb/successors-table.c?rev=896603&r1=896602&r2=896603&view=diff
==============================================================================
--- subversion/branches/fs-successor-ids/subversion/libsvn_fs_base/bdb/successors-table.c (original)
+++ subversion/branches/fs-successor-ids/subversion/libsvn_fs_base/bdb/successors-table.c Wed Jan  6 18:29:18 2010
@@ -120,28 +120,12 @@
 
   /* Advance the cursor to the key that we're looking for. */
   svn_fs_base__str_to_dbt(&key, node_id);
-  svn_fs_base__result_dbt(&value);
-  db_err = svn_bdb_dbc_get(cursor, &key, &value, DB_SET);
+  svn_fs_base__str_to_dbt(&value, succ_id);
+  db_err = svn_bdb_dbc_get(cursor, &key, &value, DB_GET_BOTH);
   if (! db_err)
-    svn_fs_base__track_dbt(&value, pool);
-
-  while (! db_err)
     {
-      /* VALUE now contains a successor ID.  Is it the one we're
-         looking to delete?  */
-      if ((value.size == strlen(succ_id)) 
-          && (memcmp(succ_id, value.data, value.size) == 0))
-        {
-          db_err = svn_bdb_dbc_del(cursor, 0);
-          break;
-        }
-      
-      /* Advance the cursor to the next record with this same KEY, and
-         fetch that record. */
-      svn_fs_base__result_dbt(&value);
-      db_err = svn_bdb_dbc_get(cursor, &key, &value, DB_NEXT_DUP);
-      if (! db_err)
-        svn_fs_base__track_dbt(&value, pool);
+      /* Delete the item at the cursor. */
+      db_err = svn_bdb_dbc_del(cursor, 0);
     }
 
   /* Record any errors we caught.  We'll return them post-cleanup. */