You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by cm...@collab.net on 2002/06/19 17:30:36 UTC

BDB deadlock problem

If you are Clueful, please see this document:

   http://www.sleepycat.com/docs/ref/cam/intro.html

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
cursor.

--

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)
        break;
      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

Re: BDB deadlock problem

Posted by cm...@collab.net.
cmpilato@collab.net writes:

> If you are Clueful, please see this document:
> 
>    http://www.sleepycat.com/docs/ref/cam/intro.html
> 
> 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
> cursor.
> 
> --
> 
> svn_error_t *
> svn_fs__string_copy (svn_fs_t *fs,
>                      const char **new_key,
>                      const char *key,
>                      trail_t *trail)

Hm... the URL seems to apply only to Berkeley DB Concurrent Data Store,
so it might not be what we're looking for, but I'm open to any idea
folks might have.  I have stack traces of 20 `svn' processes that were
banging the repository via Philip's stress.pl script, if you're
interested in helping out.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org