Fossil SCM
Commit more frequently during a sync operation to minimize number of times content must be requested when sync failures occur.
Commit
c2a69336fd2db992fb4e2c09896229052c2e1349
Parent
77f53423aec1d2e…
1 file changed
+14
-10
+14
-10
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1429,15 +1429,10 @@ | ||
| 1429 | 1429 | if( syncFlags & SYNC_PRIVATE ){ |
| 1430 | 1430 | g.perm.Private = 1; |
| 1431 | 1431 | xfer.syncPrivate = 1; |
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | - db_begin_transaction(); | |
| 1435 | - db_record_repository_filename(0); | |
| 1436 | - db_multi_exec( | |
| 1437 | - "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);" | |
| 1438 | - ); | |
| 1439 | 1434 | blobarray_zero(xfer.aToken, count(xfer.aToken)); |
| 1440 | 1435 | blob_zero(&send); |
| 1441 | 1436 | blob_zero(&recv); |
| 1442 | 1437 | blob_zero(&xfer.err); |
| 1443 | 1438 | blob_zero(&xfer.line); |
| @@ -1472,16 +1467,21 @@ | ||
| 1472 | 1467 | blob_appendf(&send, "push %s %s\n", zSCode, zPCode); |
| 1473 | 1468 | nCardSent++; |
| 1474 | 1469 | if( (syncFlags & SYNC_PULL)==0 ) zOpType = "Push"; |
| 1475 | 1470 | if( (syncFlags & SYNC_RESYNC)!=0 ) xfer.resync = 0x7fffffff; |
| 1476 | 1471 | } |
| 1477 | - manifest_crosslink_begin(); | |
| 1478 | 1472 | if( syncFlags & SYNC_VERBOSE ){ |
| 1479 | 1473 | fossil_print(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas"); |
| 1480 | 1474 | } |
| 1481 | 1475 | |
| 1482 | 1476 | while( go ){ |
| 1477 | + db_begin_transaction(); | |
| 1478 | + db_record_repository_filename(0); | |
| 1479 | + db_multi_exec( | |
| 1480 | + "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);" | |
| 1481 | + ); | |
| 1482 | + manifest_crosslink_begin(); | |
| 1483 | 1483 | int newPhantom = 0; |
| 1484 | 1484 | char *zRandomness; |
| 1485 | 1485 | |
| 1486 | 1486 | /* Send make the most recently received cookie. Let the server |
| 1487 | 1487 | ** figure out if this is a cookie that it cares about. |
| @@ -1910,10 +1910,18 @@ | ||
| 1910 | 1910 | ** we have gone at least two rounds. Always go at least two rounds |
| 1911 | 1911 | ** on a clone in order to be sure to retrieve the configuration |
| 1912 | 1912 | ** information which is only sent on the second round. |
| 1913 | 1913 | */ |
| 1914 | 1914 | if( cloneSeqno<=0 && nCycle>1 ) go = 0; |
| 1915 | + db_multi_exec("DROP TABLE onremote"); | |
| 1916 | + if( go ){ | |
| 1917 | + manifest_crosslink_end(0); | |
| 1918 | + }else{ | |
| 1919 | + manifest_crosslink_end(MC_PERMIT_HOOKS); | |
| 1920 | + content_enable_dephantomize(1); | |
| 1921 | + } | |
| 1922 | + db_end_transaction(0); | |
| 1915 | 1923 | }; |
| 1916 | 1924 | transport_stats(&nSent, &nRcvd, 1); |
| 1917 | 1925 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1918 | 1926 | fossil_warning("*** time skew *** server is fast by %s", |
| 1919 | 1927 | db_timespan_name(rSkew)); |
| @@ -1928,11 +1936,7 @@ | ||
| 1928 | 1936 | fossil_print( |
| 1929 | 1937 | "%s finished with %lld bytes sent, %lld bytes received\n", |
| 1930 | 1938 | zOpType, nSent, nRcvd); |
| 1931 | 1939 | transport_close(&g.url); |
| 1932 | 1940 | transport_global_shutdown(&g.url); |
| 1933 | - db_multi_exec("DROP TABLE onremote"); | |
| 1934 | - manifest_crosslink_end(MC_PERMIT_HOOKS); | |
| 1935 | - content_enable_dephantomize(1); | |
| 1936 | - db_end_transaction(0); | |
| 1937 | 1941 | return nErr; |
| 1938 | 1942 | } |
| 1939 | 1943 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1429,15 +1429,10 @@ | |
| 1429 | if( syncFlags & SYNC_PRIVATE ){ |
| 1430 | g.perm.Private = 1; |
| 1431 | xfer.syncPrivate = 1; |
| 1432 | } |
| 1433 | |
| 1434 | db_begin_transaction(); |
| 1435 | db_record_repository_filename(0); |
| 1436 | db_multi_exec( |
| 1437 | "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);" |
| 1438 | ); |
| 1439 | blobarray_zero(xfer.aToken, count(xfer.aToken)); |
| 1440 | blob_zero(&send); |
| 1441 | blob_zero(&recv); |
| 1442 | blob_zero(&xfer.err); |
| 1443 | blob_zero(&xfer.line); |
| @@ -1472,16 +1467,21 @@ | |
| 1472 | blob_appendf(&send, "push %s %s\n", zSCode, zPCode); |
| 1473 | nCardSent++; |
| 1474 | if( (syncFlags & SYNC_PULL)==0 ) zOpType = "Push"; |
| 1475 | if( (syncFlags & SYNC_RESYNC)!=0 ) xfer.resync = 0x7fffffff; |
| 1476 | } |
| 1477 | manifest_crosslink_begin(); |
| 1478 | if( syncFlags & SYNC_VERBOSE ){ |
| 1479 | fossil_print(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas"); |
| 1480 | } |
| 1481 | |
| 1482 | while( go ){ |
| 1483 | int newPhantom = 0; |
| 1484 | char *zRandomness; |
| 1485 | |
| 1486 | /* Send make the most recently received cookie. Let the server |
| 1487 | ** figure out if this is a cookie that it cares about. |
| @@ -1910,10 +1910,18 @@ | |
| 1910 | ** we have gone at least two rounds. Always go at least two rounds |
| 1911 | ** on a clone in order to be sure to retrieve the configuration |
| 1912 | ** information which is only sent on the second round. |
| 1913 | */ |
| 1914 | if( cloneSeqno<=0 && nCycle>1 ) go = 0; |
| 1915 | }; |
| 1916 | transport_stats(&nSent, &nRcvd, 1); |
| 1917 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1918 | fossil_warning("*** time skew *** server is fast by %s", |
| 1919 | db_timespan_name(rSkew)); |
| @@ -1928,11 +1936,7 @@ | |
| 1928 | fossil_print( |
| 1929 | "%s finished with %lld bytes sent, %lld bytes received\n", |
| 1930 | zOpType, nSent, nRcvd); |
| 1931 | transport_close(&g.url); |
| 1932 | transport_global_shutdown(&g.url); |
| 1933 | db_multi_exec("DROP TABLE onremote"); |
| 1934 | manifest_crosslink_end(MC_PERMIT_HOOKS); |
| 1935 | content_enable_dephantomize(1); |
| 1936 | db_end_transaction(0); |
| 1937 | return nErr; |
| 1938 | } |
| 1939 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1429,15 +1429,10 @@ | |
| 1429 | if( syncFlags & SYNC_PRIVATE ){ |
| 1430 | g.perm.Private = 1; |
| 1431 | xfer.syncPrivate = 1; |
| 1432 | } |
| 1433 | |
| 1434 | blobarray_zero(xfer.aToken, count(xfer.aToken)); |
| 1435 | blob_zero(&send); |
| 1436 | blob_zero(&recv); |
| 1437 | blob_zero(&xfer.err); |
| 1438 | blob_zero(&xfer.line); |
| @@ -1472,16 +1467,21 @@ | |
| 1467 | blob_appendf(&send, "push %s %s\n", zSCode, zPCode); |
| 1468 | nCardSent++; |
| 1469 | if( (syncFlags & SYNC_PULL)==0 ) zOpType = "Push"; |
| 1470 | if( (syncFlags & SYNC_RESYNC)!=0 ) xfer.resync = 0x7fffffff; |
| 1471 | } |
| 1472 | if( syncFlags & SYNC_VERBOSE ){ |
| 1473 | fossil_print(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas"); |
| 1474 | } |
| 1475 | |
| 1476 | while( go ){ |
| 1477 | db_begin_transaction(); |
| 1478 | db_record_repository_filename(0); |
| 1479 | db_multi_exec( |
| 1480 | "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);" |
| 1481 | ); |
| 1482 | manifest_crosslink_begin(); |
| 1483 | int newPhantom = 0; |
| 1484 | char *zRandomness; |
| 1485 | |
| 1486 | /* Send make the most recently received cookie. Let the server |
| 1487 | ** figure out if this is a cookie that it cares about. |
| @@ -1910,10 +1910,18 @@ | |
| 1910 | ** we have gone at least two rounds. Always go at least two rounds |
| 1911 | ** on a clone in order to be sure to retrieve the configuration |
| 1912 | ** information which is only sent on the second round. |
| 1913 | */ |
| 1914 | if( cloneSeqno<=0 && nCycle>1 ) go = 0; |
| 1915 | db_multi_exec("DROP TABLE onremote"); |
| 1916 | if( go ){ |
| 1917 | manifest_crosslink_end(0); |
| 1918 | }else{ |
| 1919 | manifest_crosslink_end(MC_PERMIT_HOOKS); |
| 1920 | content_enable_dephantomize(1); |
| 1921 | } |
| 1922 | db_end_transaction(0); |
| 1923 | }; |
| 1924 | transport_stats(&nSent, &nRcvd, 1); |
| 1925 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1926 | fossil_warning("*** time skew *** server is fast by %s", |
| 1927 | db_timespan_name(rSkew)); |
| @@ -1928,11 +1936,7 @@ | |
| 1936 | fossil_print( |
| 1937 | "%s finished with %lld bytes sent, %lld bytes received\n", |
| 1938 | zOpType, nSent, nRcvd); |
| 1939 | transport_close(&g.url); |
| 1940 | transport_global_shutdown(&g.url); |
| 1941 | return nErr; |
| 1942 | } |
| 1943 |