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

svn commit: r1436351 - in /subversion/trunk/subversion/libsvn_ra_serf: ra_serf.h serf.c update.c

Author: ivan
Date: Mon Jan 21 13:58:09 2013
New Revision: 1436351

URL: http://svn.apache.org/viewvc?rev=1436351&view=rev
Log:
ra_serf: Implement ability to override automatic bulk-mode selection using 
tristate bulk-updates option.

* subversion/libsvn_ra_serf/ra_serf.h
  (struct svn_ra_serf__session_t): Change type of bulk_updates memebr to 
   svn_tristate_t.
* subversion/libsvn_ra_serf/serf.c
  (load_config): Get 'http-bulk-updates' runtime option as tristate with 
   'yes'/'no'/'auto' values.
* subversion/libsvn_ra_serf/update.c
  (make_update_reporter): Override bulk-mode selection logic if user 
   explicitly specified desired update editor mode.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
    subversion/trunk/subversion/libsvn_ra_serf/serf.c
    subversion/trunk/subversion/libsvn_ra_serf/update.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1436351&r1=1436350&r2=1436351&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Mon Jan 21 13:58:09 2013
@@ -230,10 +230,12 @@ struct svn_ra_serf__session_t {
 
   svn_ra_serf__blncache_t *blncache;
 
-  /* Flag that indicates if we request the server for bulk updates (TRUE) with
-     all the properties and content in the update-report response. If FALSE,
-     request a skelta update-report with inlined properties. */
-  svn_boolean_t bulk_updates;
+  /* Trisate flag that indicates user preference for using bulk updates
+     (svn_tristate_true) with all the properties and content in the
+     update-report response. If svn_tristate_false, request a skelta
+     update-report with inlined properties. If svn_tristate_unknown then use
+     server preference. */
+  svn_tristate_t bulk_updates;
 
   /* Indicates if the server wants bulk update requests (Prefer) or only
      accepts skelta requests (Off). If this value is On both options are 

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1436351&r1=1436350&r2=1436351&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Mon Jan 21 13:58:09 2013
@@ -214,10 +214,11 @@ load_config(svn_ra_serf__session_t *sess
 
   /* If set, read the flag that tells us to do bulk updates or not. Defaults
      to skelta updates. */
-  SVN_ERR(svn_config_get_bool(config, &session->bulk_updates,
-                              SVN_CONFIG_SECTION_GLOBAL,
-                              SVN_CONFIG_OPTION_HTTP_BULK_UPDATES,
-                              FALSE));
+  SVN_ERR(svn_config_get_tristate(config, &session->bulk_updates,
+                                  SVN_CONFIG_SECTION_GLOBAL,
+                                  SVN_CONFIG_OPTION_HTTP_BULK_UPDATES,
+                                  "auto",
+                                  svn_tristate_unknown));
 
   /* Load the maximum number of parallel session connections. */
   svn_config_get_int64(config, &session->max_connections,
@@ -269,10 +270,11 @@ load_config(svn_ra_serf__session_t *sess
                      session->ssl_authorities);
 
       /* Load the group bulk updates flag. */
-      SVN_ERR(svn_config_get_bool(config, &session->bulk_updates,
-                                  server_group,
-                                  SVN_CONFIG_OPTION_HTTP_BULK_UPDATES,
-                                  session->bulk_updates));
+      SVN_ERR(svn_config_get_tristate(config, &session->bulk_updates,
+                                      server_group,
+                                      SVN_CONFIG_OPTION_HTTP_BULK_UPDATES,
+                                      "auto",
+                                      session->bulk_updates));
 
       /* Load the maximum number of parallel session connections,
          overriding global values. */

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1436351&r1=1436350&r2=1436351&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Mon Jan 21 13:58:09 2013
@@ -3136,6 +3136,7 @@ make_update_reporter(svn_ra_session_t *r
   svn_boolean_t server_supports_depth;
   svn_ra_serf__session_t *sess = ra_session->priv;
   svn_stringbuf_t *buf = NULL;
+  svn_boolean_t use_bulk_updates;
 
   SVN_ERR(svn_ra_serf__has_capability(ra_session, &server_supports_depth,
                                       SVN_RA_CAPABILITY_DEPTH, scratch_pool));
@@ -3182,42 +3183,58 @@ make_update_reporter(svn_ra_session_t *r
                                    svn_io_file_del_on_pool_cleanup,
                                    report->pool, scratch_pool));
 
-  if (sess->server_allows_bulk)
+  if (sess->bulk_updates == svn_tristate_true)
     {
-      if (apr_strnatcasecmp(sess->server_allows_bulk, "off") == 0)
-        {
-          /* Server doesn't want bulk updates */
-          sess->bulk_updates = FALSE;
-        }
-      else if (apr_strnatcasecmp(sess->server_allows_bulk, "prefer") == 0)
-        {
-          /* Server prefers bulk updates, and we respect that */
-          sess->bulk_updates = TRUE;
-        }
-      else
-        {
-          /* Server allows bulk updates, but doesn't dictate its use. Do
-             whatever is the default or what the user defined in the config. */
-        }
+      /* User would like to use bulk updates. */
+      use_bulk_updates = TRUE;
+    }
+  else if (sess->bulk_updates == svn_tristate_false)
+    {
+      /* User doesn't want bulk updates. */
+      use_bulk_updates = FALSE;
     }
   else
     {
-      /* Pre-1.8 server didn't send the bulk_updates header. Check if server
-         supports inlining properties in update editor report. */
-      if (sess->supports_inline_props)
+      /* User doesn't have any preferences on bulk updates. Decide on server
+         preferences and capabilities. */
+      if (sess->server_allows_bulk)
         {
-          /* Inline props supported: do not use bulk updates. */
-          sess->bulk_updates = FALSE;
+          if (apr_strnatcasecmp(sess->server_allows_bulk, "off") == 0)
+            {
+              /* Server doesn't want bulk updates */
+              use_bulk_updates = FALSE;
+            }
+          else if (apr_strnatcasecmp(sess->server_allows_bulk, "prefer") == 0)
+            {
+              /* Server prefers bulk updates, and we respect that */
+              use_bulk_updates = TRUE;
+            }
+          else
+            {
+              /* Server allows bulk updates, but doesn't dictate its use. Do
+                 whatever is the default. */
+              use_bulk_updates = FALSE;
+            }
         }
       else
         {
-          /* Inline props are noot supported: use bulk updates to avoid
-           * PROPFINDs for every added node. */
-          sess->bulk_updates = TRUE;
+          /* Pre-1.8 server didn't send the bulk_updates header. Check if server
+             supports inlining properties in update editor report. */
+          if (sess->supports_inline_props)
+            {
+              /* Inline props supported: do not use bulk updates. */
+              use_bulk_updates = FALSE;
+            }
+          else
+            {
+              /* Inline props are not supported: use bulk updates to avoid
+               * PROPFINDs for every added node. */
+              use_bulk_updates = TRUE;
+            }
         }
     }
 
-  if (sess->bulk_updates)
+  if (use_bulk_updates)
     {
       svn_xml_make_open_tag(&buf, scratch_pool, svn_xml_normal,
                             "S:update-report",