@@ -957,7 +957,7 @@ async fn clear_overwritten_versions(agent: Agent) {
957
957
interval = COMPACT_BOOKED_INTERVAL ;
958
958
}
959
959
960
- info ! ( "starting compaction..." ) ;
960
+ info ! ( "Starting compaction..." ) ;
961
961
let start = Instant :: now ( ) ;
962
962
963
963
let mut to_check: BTreeMap < i64 , ( ActorId , i64 ) > = BTreeMap :: new ( ) ;
@@ -991,7 +991,7 @@ async fn clear_overwritten_versions(agent: Agent) {
991
991
}
992
992
}
993
993
994
- info ! ( "got actors and their versions" ) ;
994
+ debug ! ( "got actors and their versions" ) ;
995
995
996
996
let cleared_versions: BTreeSet < i64 > = {
997
997
match pool. read ( ) . await {
@@ -1030,7 +1030,7 @@ async fn clear_overwritten_versions(agent: Agent) {
1030
1030
let mut inserted = 0 ;
1031
1031
1032
1032
for ( actor_id, to_clear) in to_clear_by_actor {
1033
- info ! ( %actor_id, "clearing actor {} versions" , to_clear. len( ) ) ;
1033
+ info ! ( %actor_id, "Clearing {} versions" , to_clear. len( ) ) ;
1034
1034
let booked = {
1035
1035
bookie
1036
1036
. write ( format ! ( "to_clear_get_booked:{}" , actor_id. as_simple( ) ) )
@@ -1063,7 +1063,7 @@ async fn clear_overwritten_versions(agent: Agent) {
1063
1063
}
1064
1064
1065
1065
info ! (
1066
- "compaction done, cleared {} db bookkeeping table rows in {:?}" ,
1066
+ "Compaction done, cleared {} DB bookkeeping table rows in {:?}" ,
1067
1067
deleted - inserted,
1068
1068
start. elapsed( )
1069
1069
) ;
@@ -1226,7 +1226,7 @@ fn find_cleared_db_versions(tx: &Transaction) -> rusqlite::Result<BTreeSet<i64>>
1226
1226
. collect :: < rusqlite:: Result < _ > > ( ) ?;
1227
1227
1228
1228
info ! (
1229
- "aggregated {} db versions to clear in {:?}" ,
1229
+ "Aggregated {} DB versions to clear in {:?}" ,
1230
1230
cleared_db_versions. len( ) ,
1231
1231
start. elapsed( )
1232
1232
) ;
@@ -1629,7 +1629,7 @@ async fn process_fully_buffered_changes(
1629
1629
1630
1630
let tx = conn. transaction ( ) ?;
1631
1631
1632
- info ! ( %actor_id, version, "processing buffered changes to crsql_changes (actor: {actor_id}, version: {version}, last_seq: {last_seq})" ) ;
1632
+ info ! ( %actor_id, version, "Processing buffered changes to crsql_changes (actor: {actor_id}, version: {version}, last_seq: {last_seq})" ) ;
1633
1633
1634
1634
let max_db_version: Option < i64 > = tx. prepare_cached ( "SELECT MAX(db_version) FROM __corro_buffered_changes WHERE site_id = ? AND version = ?" ) ?. query_row ( params ! [ actor_id. as_bytes( ) , version] , |row| row. get ( 0 ) ) . optional ( ) ?;
1635
1635
@@ -1649,9 +1649,9 @@ async fn process_fully_buffered_changes(
1649
1649
"# ,
1650
1650
) ?
1651
1651
. execute ( params ! [ max_db_version, actor_id. as_bytes( ) , version] ) ?;
1652
- info ! ( %actor_id, version, "inserted {count} rows from buffered into crsql_changes in {:?}" , start. elapsed( ) ) ;
1652
+ info ! ( %actor_id, version, "Inserted {count} rows from buffered into crsql_changes in {:?}" , start. elapsed( ) ) ;
1653
1653
} else {
1654
- info ! ( %actor_id, version, "no buffered rows, skipped insertion into crsql_changes" ) ;
1654
+ info ! ( %actor_id, version, "No buffered rows, skipped insertion into crsql_changes" ) ;
1655
1655
}
1656
1656
1657
1657
clear_buffered_meta ( & tx, actor_id, version..=version) ?;
@@ -1660,7 +1660,7 @@ async fn process_fully_buffered_changes(
1660
1660
. prepare_cached ( "SELECT crsql_rows_impacted()" ) ?
1661
1661
. query_row ( ( ) , |row| row. get ( 0 ) ) ?;
1662
1662
1663
- info ! ( %actor_id, version, "rows impacted by buffered changes insertion: {rows_impacted}" ) ;
1663
+ debug ! ( %actor_id, version, "rows impacted by buffered changes insertion: {rows_impacted}" ) ;
1664
1664
1665
1665
let known_version = if rows_impacted > 0 {
1666
1666
let db_version: i64 =
@@ -1687,7 +1687,7 @@ async fn process_fully_buffered_changes(
1687
1687
":ts" : ts
1688
1688
} ) ?;
1689
1689
1690
- info ! ( %actor_id, version, "inserted bookkeeping row after buffered insert" ) ;
1690
+ debug ! ( %actor_id, version, "inserted bookkeeping row after buffered insert" ) ;
1691
1691
1692
1692
Some ( KnownDbVersion :: Current {
1693
1693
db_version,
@@ -1697,7 +1697,7 @@ async fn process_fully_buffered_changes(
1697
1697
} else {
1698
1698
store_empty_changeset ( & tx, actor_id, version..=version) ?;
1699
1699
1700
- info ! ( %actor_id, version, "inserted CLEARED bookkeeping row after buffered insert" ) ;
1700
+ debug ! ( %actor_id, version, "inserted CLEARED bookkeeping row after buffered insert" ) ;
1701
1701
Some ( KnownDbVersion :: Cleared )
1702
1702
} ;
1703
1703
@@ -1735,7 +1735,7 @@ pub async fn process_multiple_changes(
1735
1735
agent : & Agent ,
1736
1736
changes : Vec < ( ChangeV1 , ChangeSource ) > ,
1737
1737
) -> Result < ( ) , ChangeError > {
1738
- info ! ( self_actor_id = %agent. actor_id( ) , "processing multiple changes, len: {}" , changes. iter( ) . map( |( change, _) | cmp:: max( change. len( ) , 1 ) ) . sum:: <usize >( ) ) ;
1738
+ debug ! ( self_actor_id = %agent. actor_id( ) , "processing multiple changes, len: {}" , changes. iter( ) . map( |( change, _) | cmp:: max( change. len( ) , 1 ) ) . sum:: <usize >( ) ) ;
1739
1739
1740
1740
let bookie = agent. bookie ( ) ;
1741
1741
@@ -1911,7 +1911,7 @@ pub async fn process_multiple_changes(
1911
1911
1912
1912
tx. commit ( ) ?;
1913
1913
1914
- info ! ( "committed {count} changes in {:?}" , start. elapsed( ) ) ;
1914
+ debug ! ( "committed {count} changes in {:?}" , start. elapsed( ) ) ;
1915
1915
1916
1916
for ( actor_id, knowns) in knowns {
1917
1917
let booked = {
@@ -1934,7 +1934,7 @@ pub async fn process_multiple_changes(
1934
1934
let version = * versions. start ( ) ;
1935
1935
if gaps_count == 0 {
1936
1936
// if we have no gaps, then we can schedule applying all these changes.
1937
- info ! ( %actor_id, version, "we now have all versions, notifying for background jobber to insert buffered changes! seqs: {seqs:?}, expected full seqs: {full_seqs_range:?}" ) ;
1937
+ debug ! ( %actor_id, version, "we now have all versions, notifying for background jobber to insert buffered changes! seqs: {seqs:?}, expected full seqs: {full_seqs_range:?}" ) ;
1938
1938
let tx_apply = agent. tx_apply ( ) . clone ( ) ;
1939
1939
tokio:: spawn ( async move {
1940
1940
if let Err ( e) = tx_apply. send ( ( actor_id, version) ) . await {
@@ -2082,7 +2082,7 @@ fn process_complete_version(
2082
2082
2083
2083
let max_db_version = changes. iter ( ) . map ( |c| c. db_version ) . max ( ) . unwrap_or ( 0 ) ;
2084
2084
2085
- info ! ( %actor_id, version, "complete change, applying right away! seqs: {seqs:?}, last_seq: {last_seq}, changes len: {len}, max db version: {max_db_version}" ) ;
2085
+ debug ! ( %actor_id, version, "complete change, applying right away! seqs: {seqs:?}, last_seq: {last_seq}, changes len: {len}, max db version: {max_db_version}" ) ;
2086
2086
2087
2087
debug_assert ! ( len <= ( seqs. end( ) - seqs. start( ) + 1 ) as usize ) ;
2088
2088
@@ -2258,8 +2258,6 @@ pub enum SyncClientError {
2258
2258
Io ( #[ from] std:: io:: Error ) ,
2259
2259
#[ error( transparent) ]
2260
2260
Pool ( #[ from] SqlitePoolError ) ,
2261
- #[ error( "no good candidates found" ) ]
2262
- NoGoodCandidate ,
2263
2261
#[ error( "could not decode message: {0}" ) ]
2264
2262
Decoded ( #[ from] SyncMessageDecodeError ) ,
2265
2263
#[ error( "could not encode message: {0}" ) ]
@@ -2321,7 +2319,7 @@ async fn handle_sync(agent: &Agent, transport: &Transport) -> Result<(), SyncCli
2321
2319
} ;
2322
2320
2323
2321
if candidates. is_empty ( ) {
2324
- return Err ( SyncClientError :: NoGoodCandidate ) ;
2322
+ return Ok ( ( ) ) ;
2325
2323
}
2326
2324
2327
2325
debug ! ( "found {} candidates to synchronize with" , candidates. len( ) ) ;
@@ -2351,7 +2349,7 @@ async fn handle_sync(agent: &Agent, transport: &Transport) -> Result<(), SyncCli
2351
2349
} ;
2352
2350
2353
2351
if chosen. is_empty ( ) {
2354
- return Err ( SyncClientError :: NoGoodCandidate ) ;
2352
+ return Ok ( ( ) ) ;
2355
2353
}
2356
2354
2357
2355
let start = Instant :: now ( ) ;
@@ -2418,7 +2416,7 @@ async fn handle_changes(
2418
2416
count = 0 ;
2419
2417
}
2420
2418
2421
- info ! ( "draining changes receiver..." ) ;
2419
+ info ! ( "Draining changes receiver..." ) ;
2422
2420
2423
2421
// drain!
2424
2422
while let Ok ( ( change, src) ) = rx_changes. try_recv ( ) {
@@ -2487,7 +2485,7 @@ async fn write_empties_loop(
2487
2485
}
2488
2486
2489
2487
if !empties. is_empty ( ) {
2490
- info ! ( "inserting last unprocessed empties before shut down" ) ;
2488
+ info ! ( "Inserting last unprocessed empties before shut down" ) ;
2491
2489
if let Err ( e) = process_completed_empties ( & agent, & mut empties) . await {
2492
2490
error ! ( "could not process empties: {e}" ) ;
2493
2491
}
@@ -2552,9 +2550,7 @@ async fn sync_loop(
2552
2550
}
2553
2551
tripwire:: Outcome :: Completed ( res) => {
2554
2552
if let Err ( e) = res {
2555
- if !matches ! ( e, SyncClientError :: NoGoodCandidate ) {
2556
- error ! ( "could not sync: {e}" ) ;
2557
- }
2553
+ error ! ( "could not sync: {e}" ) ;
2558
2554
// keep syncing until we successfully sync
2559
2555
continue ;
2560
2556
}
@@ -2565,13 +2561,13 @@ async fn sync_loop(
2565
2561
. reset ( tokio:: time:: Instant :: now ( ) + sync_backoff. next ( ) . unwrap ( ) ) ;
2566
2562
}
2567
2563
Branch :: BackgroundApply { actor_id, version } => {
2568
- info ! ( %actor_id, version, "picked up background apply of buffered changes" ) ;
2564
+ debug ! ( %actor_id, version, "picked up background apply of buffered changes" ) ;
2569
2565
match process_fully_buffered_changes ( & agent, actor_id, version) . await {
2570
2566
Ok ( false ) => {
2571
2567
warn ! ( %actor_id, version, "did not apply buffered changes" ) ;
2572
2568
}
2573
2569
Ok ( true ) => {
2574
- info ! ( %actor_id, version, "succesfully applied buffered changes" ) ;
2570
+ debug ! ( %actor_id, version, "succesfully applied buffered changes" ) ;
2575
2571
}
2576
2572
Err ( e) => {
2577
2573
error ! ( %actor_id, version, "could not apply fully buffered changes: {e}" ) ;
@@ -2587,7 +2583,7 @@ async fn process_completed_empties(
2587
2583
agent : & Agent ,
2588
2584
empties : & mut BTreeMap < ActorId , RangeInclusiveSet < i64 > > ,
2589
2585
) -> eyre:: Result < ( ) > {
2590
- info ! (
2586
+ debug ! (
2591
2587
"processing empty versions (count: {})" ,
2592
2588
empties. values( ) . map( RangeInclusiveSet :: len) . sum:: <usize >( )
2593
2589
) ;
@@ -2614,7 +2610,7 @@ async fn process_completed_empties(
2614
2610
}
2615
2611
}
2616
2612
2617
- info ! (
2613
+ debug ! (
2618
2614
"upserted {inserted} empty version ranges in {:?}" ,
2619
2615
start. elapsed( )
2620
2616
) ;
@@ -3125,11 +3121,11 @@ pub mod tests {
3125
3121
3126
3122
let actual_count: i64 =
3127
3123
conn. query_row ( "SELECT count(*) FROM crsql_changes;" , ( ) , |row| row. get ( 0 ) ) ?;
3128
- info ! ( "actual count: {actual_count}" ) ;
3124
+ debug ! ( "actual count: {actual_count}" ) ;
3129
3125
3130
3126
let bookie = ta. agent . bookie ( ) ;
3131
3127
3132
- info ! (
3128
+ debug ! (
3133
3129
"last version: {:?}" ,
3134
3130
bookie
3135
3131
. write( "test" )
@@ -3144,7 +3140,6 @@ pub mod tests {
3144
3140
let needed = sync. need_len ( ) ;
3145
3141
3146
3142
debug ! ( "generated sync: {sync:?}" ) ;
3147
- info ! ( "needed: {needed}" ) ;
3148
3143
3149
3144
v. push ( ( counts. values ( ) . sum :: < i64 > ( ) , needed) ) ;
3150
3145
}
0 commit comments