After cherry-picking r1167546 from trunk to the fs-successor-ids branch
in r1167550, reintegrating that branch to trunk takes a long time
(sufficiently long for the server to assume the client has
disconnected).

Stefan debugged this and found that most time is spent in
combine_with_lastrange().  (Backtrace attached.)

Adding a debug print (patch attached) just above the qsort() shows an
interesting pattern:

[[[
DBG: mergeinfo.c: 439: Sorting with 253 elements
DBG: mergeinfo.c: 439: Sorting with 254 elements
DBG: mergeinfo.c: 439: Sorting with 255 elements
DBG: mergeinfo.c: 439: Sorting with 256 elements
DBG: mergeinfo.c: 439: Sorting with 257 elements
DBG: mergeinfo.c: 439: Sorting with 258 elements
DBG: mergeinfo.c: 439: Sorting with 259 elements
DBG: mergeinfo.c: 439: Sorting with 260 elements
DBG: mergeinfo.c: 439: Sorting with 261 elements
DBG: mergeinfo.c: 439: Sorting with 262 elements
DBG: mergeinfo.c: 439: Sorting with 263 elements
]]]

That happens with both serf and neon, and Stefan reports it was fast
yesterday (before my cherry-pick and other commits today).
Index: subversion/libsvn_subr/mergeinfo.c
===================================================================
--- subversion/libsvn_subr/mergeinfo.c  (revision 1167556)
+++ subversion/libsvn_subr/mergeinfo.c  (working copy)
@@ -436,6 +436,7 @@ combine_with_lastrange(const svn_merge_range_t *ne
 
               /* Some of the above cases might have put *RANGELIST out of
                  order, so re-sort.*/
+              SVN_DBG(("Sorting with %ld elements\n", (long)rangelist->nelts));
               qsort(rangelist->elts, rangelist->nelts, rangelist->elt_size,
                     svn_sort_compare_ranges);
         }
#0  qsort (aa=Variable "aa" is not available.
) at /usr/src/lib/libc/stdlib/qsort.c:141
#1  0x00000002029af2c0 in combine_with_lastrange (new_range=0x20c259d30, 
    rangelist=0x2053a0f70, consider_inheritance=1, result_pool=0x207c82028, 
    scratch_pool=0x207f2d028) at subversion/libsvn_subr/mergeinfo.c:439
#2  0x00000002029b0124 in svn_rangelist_merge2 (rangelist=0x2053a0f70, 
    changes=0x2072cf480, result_pool=0x207c82028, scratch_pool=0x207f2d028)
    at subversion/libsvn_subr/mergeinfo.c:768
#3  0x00000002029b1452 in svn_mergeinfo_merge (mergeinfo=0x2053a0ea8, 
    changes=0x2072cf3b8, pool=0x207c82028)
    at subversion/libsvn_subr/mergeinfo.c:1332
#4  0x000000020dfba655 in log_find_operative_revs (baton=0x7f7ffffbff50, 
    log_entry=0x20f61b0d0, pool=0x20f61b028)
    at subversion/libsvn_client/merge.c:10161
...
#21 0x000000020321740c in svn_ra_get_log2 (session=0x20703b0e8, 
    paths=0x2053a02c8, start=1167545, end=880536, limit=0, 
    discover_changed_paths=1, strict_node_history=0, 
    include_merged_revisions=0, revprops=0x0, 
    receiver=0x20dfba393 <log_find_operative_revs>, 
    receiver_baton=0x7f7ffffbff50, pool=0x207c82028)
    at subversion/libsvn_ra/ra_loader.c:914
#22 0x000000020dfba95a in find_unsynced_ranges (
    source_repos_rel_path=0x206434ff8 "subversion/branches/fs-successor-ids", 
    target_repos_rel_path=0x20539f331 "subversion/trunk", 
    unmerged_catalog=0x200e49a18, merged_catalog=0x20b0dba18, 
    true_unmerged_catalog=0x2053a0180, ra_session=0x20703b0e8, 
    result_pool=0x207c82028, scratch_pool=0x207c82028)
    at subversion/libsvn_client/merge.c:10275
#23 0x000000020dfbc7c7 in merge_reintegrate_locked (
    source=0x20d537c38 
"https://svn.apache.org/repos/asf/subversion/branches/fs-successor-ids";, 
peg_revision=0x7f7ffffc0420, 
    target_abspath=0x20d537e70 "/home/stsp/svn/svn-trunk3", dry_run=0, 
    merge_options=0x0, ctx=0x207c82990, scratch_pool=0x207c82028)
    at subversion/libsvn_client/merge.c:11037
#24 0x000000020dfbca70 in merge_reintegrate_cb (baton=0x7f7ffffc0330, 
    result_pool=0x207c82028, scratch_pool=0x207c82028)
    at subversion/libsvn_client/merge.c:11112
#25 0x0000000208e64a84 in svn_wc__call_with_write_lock (
    func=0x20dfbca12 <merge_reintegrate_cb>, baton=0x7f7ffffc0330, 
    wc_ctx=0x207c82a48, local_abspath=0x20d537e70 "/home/stsp/svn/svn-trunk3", 
    lock_anchor=0, result_pool=0x207c82028, scratch_pool=0x207c82028)
    at subversion/libsvn_wc/lock.c:1627
#26 0x000000020dfbcb9a in svn_client_merge_reintegrate (
    source=0x20d537c38 
"https://svn.apache.org/repos/asf/subversion/branches/fs-successor-ids";, 
peg_revision=0x7f7ffffc0420, target_wcpath=0x532c88 "", 
    dry_run=0, merge_options=0x0, ctx=0x207c82990, pool=0x207c82028)
    at subversion/libsvn_client/merge.c:11143
#27 0x00000000004164cd in svn_cl__merge (os=0x207c82278, baton=0x7f7ffffc07b0, 
    pool=0x207c82028) at subversion/svn/merge-cmd.c:322
#28 0x00000000004159e6 in main (argc=4, argv=0x7f7ffffc0908)
    at subversion/svn/main.c:2628

Reply via email to