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

BDB deadlock problem

From: <cmpilato_at_collab.net>
Date: 2002-06-19 19:30:36 CEST

If you are Clueful, please see this document:


And the following function (in strings-table.c), and let the list know
if you see anything that seems out of order. I'm concerned about the
call to fs->strings->put() that occurs prior to the closing of the

svn_error_t *
svn_fs__string_copy (svn_fs_t *fs,
                     const char **new_key,
                     const char *key,
                     trail_t *trail)
  DBT query;
  DBT result;
  DBT copykey;
  DBC *cursor;
  int db_err;
  /* Copy off the old key in case the caller is sharing storage
     between the old and new keys. */
  const char *old_key = apr_pstrdup (trail->pool, key);
  SVN_ERR (get_key_and_bump (fs, new_key, trail));
  SVN_ERR (DB_WRAP (fs, "creating cursor for reading a string",
                    fs->strings->cursor (fs->strings, trail->db_txn,
                                         &cursor, 0)));
  svn_fs__str_to_dbt (&query, (char *) old_key);
  svn_fs__str_to_dbt (&copykey, (char *) *new_key);
  svn_fs__clear_dbt (&result);
  /* Move to the first record and fetch its data (under BDB's mem mgmt). */
  db_err = cursor->c_get (cursor, &query, &result, DB_SET);
  if (db_err)
      cursor->c_close (cursor);
      return DB_WRAP (fs, "getting next-key value", db_err);
  while (1)
      /* ### can we pass a BDB-provided buffer to another BDB function?
         ### they are supposed to have a duration up to certain points
         ### of calling back into BDB, but I'm not sure what the exact
         ### rules are. it is definitely nicer to use BDB buffers here
         ### to simplify things and reduce copies, but... hrm.
      /* Write the data to the database */
      db_err = fs->strings->put (fs->strings, trail->db_txn,
                                 &copykey, &result, 0);
      if (db_err)
          cursor->c_close (cursor);
          return DB_WRAP (fs, "writing copied data", db_err);
      /* Read the next chunk. Terminate loop if we're done. */
      svn_fs__clear_dbt (&result);
      db_err = cursor->c_get (cursor, &query, &result, DB_NEXT_DUP);
      if (db_err == DB_NOTFOUND)
      if (db_err)
          cursor->c_close (cursor);
          return DB_WRAP (fs, "fetching string data for a copy", db_err);
  cursor->c_close (cursor);
  return SVN_NO_ERROR;
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jun 19 19:27:05 2002

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