Fossil SCM

Commit more frequently during a sync operation to minimize number of times content must be requested when sync failures occur.

andybradford 2014-05-03 05:58 UTC trunk
Commit c2a69336fd2db992fb4e2c09896229052c2e1349
1 file changed +14 -10
+14 -10
--- src/xfer.c
+++ src/xfer.c
@@ -1429,15 +1429,10 @@
14291429
if( syncFlags & SYNC_PRIVATE ){
14301430
g.perm.Private = 1;
14311431
xfer.syncPrivate = 1;
14321432
}
14331433
1434
- db_begin_transaction();
1435
- db_record_repository_filename(0);
1436
- db_multi_exec(
1437
- "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
1438
- );
14391434
blobarray_zero(xfer.aToken, count(xfer.aToken));
14401435
blob_zero(&send);
14411436
blob_zero(&recv);
14421437
blob_zero(&xfer.err);
14431438
blob_zero(&xfer.line);
@@ -1472,16 +1467,21 @@
14721467
blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
14731468
nCardSent++;
14741469
if( (syncFlags & SYNC_PULL)==0 ) zOpType = "Push";
14751470
if( (syncFlags & SYNC_RESYNC)!=0 ) xfer.resync = 0x7fffffff;
14761471
}
1477
- manifest_crosslink_begin();
14781472
if( syncFlags & SYNC_VERBOSE ){
14791473
fossil_print(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
14801474
}
14811475
14821476
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();
14831483
int newPhantom = 0;
14841484
char *zRandomness;
14851485
14861486
/* Send make the most recently received cookie. Let the server
14871487
** figure out if this is a cookie that it cares about.
@@ -1910,10 +1910,18 @@
19101910
** we have gone at least two rounds. Always go at least two rounds
19111911
** on a clone in order to be sure to retrieve the configuration
19121912
** information which is only sent on the second round.
19131913
*/
19141914
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);
19151923
};
19161924
transport_stats(&nSent, &nRcvd, 1);
19171925
if( (rSkew*24.0*3600.0) > 10.0 ){
19181926
fossil_warning("*** time skew *** server is fast by %s",
19191927
db_timespan_name(rSkew));
@@ -1928,11 +1936,7 @@
19281936
fossil_print(
19291937
"%s finished with %lld bytes sent, %lld bytes received\n",
19301938
zOpType, nSent, nRcvd);
19311939
transport_close(&g.url);
19321940
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);
19371941
return nErr;
19381942
}
19391943
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button