You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2014/10/09 10:14:01 UTC

svn commit: r1630312 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c update_editor.c wc_db.c wc_db.h

Author: rhuijben
Date: Thu Oct  9 08:14:00 2014
New Revision: 1630312

URL: http://svn.apache.org/r1630312
Log:
In preparation for running more of the post commit processing in a single
sqlite transaction, update read only status for unlock operations from the
working queue.

This probably introduces a temporary performance regression for this scenario.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc_remove_lock2): Create work item and pass that to db operation.

* subversion/libsvn_wc/update_editor.c
  (close_file): Update caller.

* subversion/libsvn_wc/wc_db.c
  (lock_remove_txn,
   svn_wc__db_lock_remove): Add work_items handling.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_lock_remove): Add work_items handling.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1630312&r1=1630311&r2=1630312&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Thu Oct  9 08:14:00 2014
@@ -1231,7 +1231,7 @@ svn_wc_remove_lock2(svn_wc_context_t *wc
                     apr_pool_t *scratch_pool)
 {
   svn_error_t *err;
-  const svn_string_t *needs_lock;
+  svn_skel_t *work_item;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -1239,7 +1239,12 @@ svn_wc_remove_lock2(svn_wc_context_t *wc
                               svn_dirent_dirname(local_abspath, scratch_pool),
                               scratch_pool));
 
-  err = svn_wc__db_lock_remove(wc_ctx->db, local_abspath, scratch_pool);
+  SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item,
+                                           wc_ctx->db, local_abspath,
+                                           scratch_pool, scratch_pool));
+
+  err = svn_wc__db_lock_remove(wc_ctx->db, local_abspath, work_item,
+                               scratch_pool);
   if (err)
     {
       if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
@@ -1253,24 +1258,9 @@ svn_wc_remove_lock2(svn_wc_context_t *wc
                                                       scratch_pool));
     }
 
-  /* if svn:needs-lock is present, then make the file read-only. */
-  err = svn_wc__internal_propget(&needs_lock, wc_ctx->db, local_abspath,
-                                 SVN_PROP_NEEDS_LOCK, scratch_pool,
-                                 scratch_pool);
-  if (err)
-    {
-      if (err->apr_err != SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
-        return svn_error_trace(err);
-
-      svn_error_clear(err);
-      return SVN_NO_ERROR; /* Node is shadowed and/or deleted,
-                              so we shouldn't apply its lock */
-    }
-
-  if (needs_lock)
-    SVN_ERR(svn_io_set_file_read_only(local_abspath, FALSE, scratch_pool));
-
-  return SVN_NO_ERROR;
+  return svn_error_trace(svn_wc__wq_run(wc_ctx->db, local_abspath,
+                                        NULL, NULL /* cancel*/,
+                                        scratch_pool));
 }
 
 

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1630312&r1=1630311&r2=1630312&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Oct  9 08:14:00 2014
@@ -4342,7 +4342,7 @@ close_file(void *file_baton,
                 || strcmp(fb->new_repos_relpath, fb->old_repos_relpath) == 0)
               {
                 SVN_ERR_ASSERT(prop->value == NULL);
-                SVN_ERR(svn_wc__db_lock_remove(eb->db, fb->local_abspath,
+                SVN_ERR(svn_wc__db_lock_remove(eb->db, fb->local_abspath, NULL,
                                                scratch_pool));
 
                 lock_state = svn_wc_notify_lock_state_unlocked;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1630312&r1=1630311&r2=1630312&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Oct  9 08:14:00 2014
@@ -11925,6 +11925,7 @@ svn_wc__db_lock_add(svn_wc__db_t *db,
 static svn_error_t *
 lock_remove_txn(svn_wc__db_wcroot_t *wcroot,
                 const char *local_relpath,
+                svn_skel_t *work_items,
                 apr_pool_t *scratch_pool)
 {
   const char *repos_relpath;
@@ -11944,6 +11945,8 @@ lock_remove_txn(svn_wc__db_wcroot_t *wcr
 
   SVN_ERR(svn_sqlite__step_done(stmt));
 
+  SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
+
   return SVN_NO_ERROR;
 }
 
@@ -11951,6 +11954,7 @@ lock_remove_txn(svn_wc__db_wcroot_t *wcr
 svn_error_t *
 svn_wc__db_lock_remove(svn_wc__db_t *db,
                        const char *local_abspath,
+                       svn_skel_t *work_items,
                        apr_pool_t *scratch_pool)
 {
   svn_wc__db_wcroot_t *wcroot;
@@ -11963,7 +11967,7 @@ svn_wc__db_lock_remove(svn_wc__db_t *db,
   VERIFY_USABLE_WCROOT(wcroot);
 
   SVN_WC__DB_WITH_TXN(
-    lock_remove_txn(wcroot, local_relpath, scratch_pool),
+    lock_remove_txn(wcroot, local_relpath, work_items, scratch_pool),
     wcroot);
 
   /* There may be some entries, and the lock info is now out of date.  */

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1630312&r1=1630311&r2=1630312&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Oct  9 08:14:00 2014
@@ -2633,10 +2633,12 @@ svn_wc__db_lock_add(svn_wc__db_t *db,
                     apr_pool_t *scratch_pool);
 
 
-/* Remove any lock for LOCAL_ABSPATH in DB.  */
+/* Remove any lock for LOCAL_ABSPATH in DB and install WORK_ITEMS
+   (if not NULL) in DB */
 svn_error_t *
 svn_wc__db_lock_remove(svn_wc__db_t *db,
                        const char *local_abspath,
+                       svn_skel_t *work_items,
                        apr_pool_t *scratch_pool);