@@ -99,10 +99,10 @@ pub struct ComputeDirtyAndCleanUpdate {
9999 pub new_dirty_container_count : i32 ,
100100 pub old_current_session_clean_container_count : i32 ,
101101 pub new_current_session_clean_container_count : i32 ,
102- pub old_dirty_value : i32 ,
103- pub new_dirty_value : i32 ,
104- pub old_current_session_clean_value : i32 ,
105- pub new_current_session_clean_value : i32 ,
102+ pub old_self_dirty : bool ,
103+ pub new_self_dirty : bool ,
104+ pub old_current_session_self_clean : bool ,
105+ pub new_current_session_self_clean : bool ,
106106}
107107
108108pub struct ComputeDirtyAndCleanUpdateResult {
@@ -117,23 +117,19 @@ impl ComputeDirtyAndCleanUpdate {
117117 new_dirty_container_count,
118118 old_current_session_clean_container_count,
119119 new_current_session_clean_container_count,
120- old_dirty_value ,
121- new_dirty_value ,
122- old_current_session_clean_value ,
123- new_current_session_clean_value ,
120+ old_self_dirty ,
121+ new_self_dirty ,
122+ old_current_session_self_clean ,
123+ new_current_session_self_clean ,
124124 } = self ;
125- let was_dirty_without_clean = old_dirty_container_count + old_dirty_value > 0 ;
126- let is_dirty_without_clean = new_dirty_container_count + new_dirty_value > 0 ;
127- let was_dirty = was_dirty_without_clean
128- && old_dirty_container_count + old_dirty_value
129- - old_current_session_clean_container_count
130- - old_current_session_clean_value
131- > 0 ;
132- let is_dirty = is_dirty_without_clean
133- && new_dirty_container_count + new_dirty_value
134- - new_current_session_clean_container_count
135- - new_current_session_clean_value
136- > 0 ;
125+ let was_dirty_without_clean = old_self_dirty || old_dirty_container_count > 0 ;
126+ let is_dirty_without_clean = new_self_dirty || new_dirty_container_count > 0 ;
127+ let was_dirty = old_self_dirty && !old_current_session_self_clean
128+ || old_dirty_container_count > 0
129+ && old_dirty_container_count > old_current_session_clean_container_count;
130+ let is_dirty = new_self_dirty && !new_current_session_self_clean
131+ || new_dirty_container_count > 0
132+ && new_dirty_container_count > new_current_session_clean_container_count;
137133 let was_flagged_clean = was_dirty_without_clean && !was_dirty;
138134 let is_flagged_clean = is_dirty_without_clean && !is_dirty;
139135
@@ -501,9 +497,7 @@ impl AggregatedDataUpdate {
501497 before_after_to_diff_value ( was_single_container_clean, is_single_container_clean) ;
502498
503499 if dirty_container_count_update != 0 || current_session_clean_update != 0 {
504- let ( is_dirty, current_session_clean) = task. dirty ( current_session_id) ;
505- let dirty_value = if is_dirty { 1 } else { 0 } ;
506- let clean_value = if current_session_clean { 1 } else { 0 } ;
500+ let ( is_self_dirty, current_session_self_clean) = task. dirty ( current_session_id) ;
507501
508502 let task_id = task. id ( ) ;
509503
@@ -525,8 +519,8 @@ impl AggregatedDataUpdate {
525519 old_dirty_container_count = new_dirty_container_count;
526520 } ;
527521
528- let was_dirty_without_clean = old_dirty_container_count + dirty_value > 0 ;
529- let is_dirty_without_clean = new_dirty_container_count + dirty_value > 0 ;
522+ let was_dirty_without_clean = is_self_dirty || old_dirty_container_count > 0 ;
523+ let is_dirty_without_clean = is_self_dirty || new_dirty_container_count > 0 ;
530524
531525 let upper_count_update =
532526 before_after_to_diff_value ( was_dirty_without_clean, is_dirty_without_clean) ;
@@ -557,16 +551,14 @@ impl AggregatedDataUpdate {
557551 new_current_session_clean_container_count;
558552 } ;
559553
560- let was_dirty = was_dirty_without_clean
561- && old_dirty_container_count + dirty_value
562- - old_current_session_clean_container_count
563- - clean_value
564- > 0 ;
565- let is_dirty = is_dirty_without_clean
566- && new_dirty_container_count + dirty_value
567- - new_current_session_clean_container_count
568- - clean_value
569- > 0 ;
554+ let was_dirty = is_self_dirty && !current_session_self_clean
555+ || old_dirty_container_count > 0
556+ && old_dirty_container_count - old_current_session_clean_container_count
557+ > 0 ;
558+ let is_dirty = is_self_dirty && !current_session_self_clean
559+ || new_dirty_container_count > 0
560+ && new_dirty_container_count - new_current_session_clean_container_count
561+ > 0 ;
570562
571563 let was_flagged_clean = was_dirty_without_clean && !was_dirty;
572564 let is_flagged_clean = is_dirty_without_clean && !is_dirty;
@@ -578,10 +570,10 @@ impl AggregatedDataUpdate {
578570 new_dirty_container_count,
579571 old_current_session_clean_container_count,
580572 new_current_session_clean_container_count,
581- old_dirty_value : dirty_value ,
582- new_dirty_value : dirty_value ,
583- old_current_session_clean_value : clean_value ,
584- new_current_session_clean_value : clean_value ,
573+ old_self_dirty : is_self_dirty ,
574+ new_self_dirty : is_self_dirty ,
575+ old_current_session_self_clean : current_session_self_clean ,
576+ new_current_session_self_clean : current_session_self_clean ,
585577 }
586578 . compute ( ) ;
587579 assert_eq ! ( compute_result. dirty_count_update, upper_count_update) ;
0 commit comments