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/06/29 19:04:57 UTC

svn commit: r959033 - in /subversion/trunk/subversion/libsvn_wc: log.c wc_db.c wc_db.h

Author: cmpilato
Date: Tue Jun 29 17:04:56 2010
New Revision: 959033

URL: http://svn.apache.org/viewvc?rev=959033&view=rev
Log:
Make 'svn cleanup' also purge the DAV cache.  The cache suffers from
flakiness from time to time, and the pre-1.7 prescribed workarounds
aren't as user-friendly in WC-NG.

* subversion/libsvn_wc/wc_db.h,
* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_base_clear_dav_cache_recursive): New function.

* subversion/libsvn_wc/log.c
  (cleanup_internal): Purge dav props on a per-directory basis (multi-db mode).
  (svn_wc_cleanup3): Purge dav props en totale (single-db mode).

Modified:
    subversion/trunk/subversion/libsvn_wc/log.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/subversion/libsvn_wc/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.c?rev=959033&r1=959032&r2=959033&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.c (original)
+++ subversion/trunk/subversion/libsvn_wc/log.c Tue Jun 29 17:04:56 2010
@@ -850,6 +850,12 @@ cleanup_internal(svn_wc__db_t *db,
         }
     }
 
+#ifndef SINGLE_DB
+  /* Purge the DAV props at and under ADM_ABSPATH. */
+  /* ### in single-db mode, we need do this purge at the top-level only. */
+  SVN_ERR(svn_wc__db_base_clear_dav_cache_recursive(db, adm_abspath, iterpool));
+#endif
+
   /* Cleanup the tmp area of the admin subdir, if running the log has not
      removed it!  The logs have been run, so anything left here has no hope
      of being useful. */
@@ -887,6 +893,12 @@ svn_wc_cleanup3(svn_wc_context_t *wc_ctx
   SVN_ERR(cleanup_internal(db, local_abspath, cancel_func, cancel_baton,
                            scratch_pool));
 
+#ifdef SINGLE_DB
+  /* Purge the DAV props at and under LOCAL_ABSPATH. */
+  /* ### in single-db mode, we need do this purge at the top-level only. */
+  SVN_ERR(svn_wc__db_base_clear_dav_cache_recursive(db, adm_abspath, iterpool));
+#endif
+
   /* We're done with this DB, so proactively close it.  */
   SVN_ERR(svn_wc__db_close(db));
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=959033&r1=959032&r2=959033&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Jun 29 17:04:56 2010
@@ -2178,6 +2178,36 @@ svn_wc__db_base_get_dav_cache(apr_hash_t
 
 
 svn_error_t *
+svn_wc__db_base_clear_dav_cache_recursive(svn_wc__db_t *db,
+                                          const char *local_abspath,
+                                          apr_pool_t *scratch_pool)
+{
+  svn_wc__db_pdh_t *pdh;
+  const char *local_relpath;
+  const char *like_arg;
+  svn_sqlite__stmt_t *stmt;
+
+  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath,
+                                             db, local_abspath,
+                                             svn_sqlite__mode_readwrite,
+                                             scratch_pool, scratch_pool));
+  VERIFY_USABLE_PDH(pdh);
+
+  if (local_relpath[0] == 0)
+    like_arg = "%";
+  else
+    like_arg = apr_pstrcat(scratch_pool,
+                           escape_sqlite_like(local_relpath, scratch_pool),
+                           "/%", NULL);
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+                                    STMT_CLEAR_BASE_RECURSIVE_DAV_CACHE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "iss", pdh->wcroot->wc_id, local_relpath,
+                            like_arg));
+  return svn_error_return(svn_sqlite__step_done(stmt));
+}
+
+svn_error_t *
 svn_wc__db_pristine_get_path(const char **pristine_abspath,
                              svn_wc__db_t *db,
                              const char *wri_abspath,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=959033&r1=959032&r2=959033&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Jun 29 17:04:56 2010
@@ -808,6 +808,13 @@ svn_wc__db_base_get_dav_cache(apr_hash_t
                               apr_pool_t *result_pool,
                               apr_pool_t *scratch_pool);
 
+/* Recursively clear the dav cache for LOCAL_ABSPATH.  Use
+   SCRATCH_POOL for temporary allocations. */
+svn_error_t *
+svn_wc__db_base_clear_dav_cache_recursive(svn_wc__db_t *db,
+                                          const char *local_abspath,
+                                          apr_pool_t *scratch_pool);
+
 
 /* ### how to handle depth? empty != absent. thus, record depth on each
    ### directory? empty, files, immediates, infinity. recording depth