Fossil SCM

Fixes to the sync algorithm.

drh 2007-08-01 10:27 trunk
Commit 0c102d06c3ba37128c3965acb718e086e7d462ff
1 file changed +17
+17
--- src/xfer.c
+++ src/xfer.c
@@ -445,10 +445,24 @@
445445
db_finalize(&q);
446446
}
447447
if( isPull ){
448448
send_all_pending(0);
449449
}
450
+ if( isPush || isPull ){
451
+ /* Always send our leaves */
452
+ Stmt q;
453
+ db_prepare(&q,
454
+ "SELECT uuid FROM blob WHERE rid IN"
455
+ " (SELECT cid FROM plink EXCEPT SELECT pid FROM plink)"
456
+ );
457
+ while( db_step(&q)==SQLITE_ROW ){
458
+ const char *zUuid = db_column_text(&q, 0);
459
+ @ leaf %s(zUuid)
460
+ }
461
+ db_finalize(&q);
462
+ }
463
+
450464
db_end_transaction(0);
451465
}
452466
453467
/*
454468
** COMMAND: test-xfer
@@ -498,10 +512,11 @@
498512
const char *zSCode = db_get("server-code", "x");
499513
const char *zPCode = db_get("project-code", 0);
500514
int nFile = 0;
501515
int nMsg = 0;
502516
int nReq = 0;
517
+ int nFileSend;
503518
Blob send; /* Text we are sending to the server */
504519
Blob recv; /* Reply we got back from the server */
505520
Blob line; /* A single line of the reply */
506521
Blob aToken[5]; /* A tokenization of line */
507522
Blob errmsg; /* Error message */
@@ -578,10 +593,11 @@
578593
}
579594
580595
/* Exchange messages with the server */
581596
printf("Send: %d files, %d requests, %d other messages\n",
582597
nFile, nReq, nMsg);
598
+ nFileSend = nFile;
583599
nFile = nReq = nMsg = 0;
584600
http_exchange(&send, &recv);
585601
blob_reset(&send);
586602
587603
/* Process the reply that came back from the server */
@@ -688,14 +704,15 @@
688704
blobarray_reset(aToken, nToken);
689705
}
690706
blob_reset(&recv);
691707
printf("Received: %d files, %d requests, %d other messages\n",
692708
nFile, nReq, nMsg);
709
+ if( nFileSend + nFile==0 ){ go = 0; }
693710
nFile = nReq = nMsg = 0;
694711
};
695712
http_close();
696713
db_end_transaction(0);
697714
db_multi_exec(
698715
"DROP TABLE onremote;"
699716
"DROP TABLE pending;"
700717
);
701718
}
702719
--- src/xfer.c
+++ src/xfer.c
@@ -445,10 +445,24 @@
445 db_finalize(&q);
446 }
447 if( isPull ){
448 send_all_pending(0);
449 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450 db_end_transaction(0);
451 }
452
453 /*
454 ** COMMAND: test-xfer
@@ -498,10 +512,11 @@
498 const char *zSCode = db_get("server-code", "x");
499 const char *zPCode = db_get("project-code", 0);
500 int nFile = 0;
501 int nMsg = 0;
502 int nReq = 0;
 
503 Blob send; /* Text we are sending to the server */
504 Blob recv; /* Reply we got back from the server */
505 Blob line; /* A single line of the reply */
506 Blob aToken[5]; /* A tokenization of line */
507 Blob errmsg; /* Error message */
@@ -578,10 +593,11 @@
578 }
579
580 /* Exchange messages with the server */
581 printf("Send: %d files, %d requests, %d other messages\n",
582 nFile, nReq, nMsg);
 
583 nFile = nReq = nMsg = 0;
584 http_exchange(&send, &recv);
585 blob_reset(&send);
586
587 /* Process the reply that came back from the server */
@@ -688,14 +704,15 @@
688 blobarray_reset(aToken, nToken);
689 }
690 blob_reset(&recv);
691 printf("Received: %d files, %d requests, %d other messages\n",
692 nFile, nReq, nMsg);
 
693 nFile = nReq = nMsg = 0;
694 };
695 http_close();
696 db_end_transaction(0);
697 db_multi_exec(
698 "DROP TABLE onremote;"
699 "DROP TABLE pending;"
700 );
701 }
702
--- src/xfer.c
+++ src/xfer.c
@@ -445,10 +445,24 @@
445 db_finalize(&q);
446 }
447 if( isPull ){
448 send_all_pending(0);
449 }
450 if( isPush || isPull ){
451 /* Always send our leaves */
452 Stmt q;
453 db_prepare(&q,
454 "SELECT uuid FROM blob WHERE rid IN"
455 " (SELECT cid FROM plink EXCEPT SELECT pid FROM plink)"
456 );
457 while( db_step(&q)==SQLITE_ROW ){
458 const char *zUuid = db_column_text(&q, 0);
459 @ leaf %s(zUuid)
460 }
461 db_finalize(&q);
462 }
463
464 db_end_transaction(0);
465 }
466
467 /*
468 ** COMMAND: test-xfer
@@ -498,10 +512,11 @@
512 const char *zSCode = db_get("server-code", "x");
513 const char *zPCode = db_get("project-code", 0);
514 int nFile = 0;
515 int nMsg = 0;
516 int nReq = 0;
517 int nFileSend;
518 Blob send; /* Text we are sending to the server */
519 Blob recv; /* Reply we got back from the server */
520 Blob line; /* A single line of the reply */
521 Blob aToken[5]; /* A tokenization of line */
522 Blob errmsg; /* Error message */
@@ -578,10 +593,11 @@
593 }
594
595 /* Exchange messages with the server */
596 printf("Send: %d files, %d requests, %d other messages\n",
597 nFile, nReq, nMsg);
598 nFileSend = nFile;
599 nFile = nReq = nMsg = 0;
600 http_exchange(&send, &recv);
601 blob_reset(&send);
602
603 /* Process the reply that came back from the server */
@@ -688,14 +704,15 @@
704 blobarray_reset(aToken, nToken);
705 }
706 blob_reset(&recv);
707 printf("Received: %d files, %d requests, %d other messages\n",
708 nFile, nReq, nMsg);
709 if( nFileSend + nFile==0 ){ go = 0; }
710 nFile = nReq = nMsg = 0;
711 };
712 http_close();
713 db_end_transaction(0);
714 db_multi_exec(
715 "DROP TABLE onremote;"
716 "DROP TABLE pending;"
717 );
718 }
719

Keyboard Shortcuts

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