[Spread-cvs] commit: r896 - branches/work_4_4_1/daemon

jschultz at spread.org jschultz at spread.org
Wed Mar 28 01:00:40 EDT 2018


Author: jschultz
Date: 2018-03-28 01:00:40 -0400 (Wed, 28 Mar 2018)
New Revision: 896

Modified:
   branches/work_4_4_1/daemon/membership.c
   branches/work_4_4_1/daemon/protocol.c
Log:
Attempted bugfix for new packets received after sending form1 that are not reflected on form2
	-- Handle when our Highest_seq is higher than what is on form2
	-- Recompute My_aru due to dropping of such packets (old code didn't do this when we dropped such packets still marked as holes on form2)
Changed some int's -> int32's that are used for indexing packet sequences


Modified: branches/work_4_4_1/daemon/membership.c
===================================================================
--- branches/work_4_4_1/daemon/membership.c	2018-03-28 01:53:48 UTC (rev 895)
+++ branches/work_4_4_1/daemon/membership.c	2018-03-28 05:00:40 UTC (rev 896)
@@ -2046,7 +2046,9 @@
 	int             tot_len;
 	proc		p;
 	int		ret;
-	int		i;
+	int32		i;
+        int32           my_aru;
+        int32           my_aru2;
         int32           memb_time = 0;
 
 	num_bytes  = 0;
@@ -2193,10 +2195,52 @@
         Prot_set_prev_proc(&Future_membership);
 	FC_new_configuration( );
 
-	Alarmp( SPLOG_INFO, MEMB, "Read_form2: updating Highest_seq %d -> %d; Aru %d -> %d\n", Highest_seq, my_rg_info->highest_seq, Aru, my_rg_info->aru );
+	Alarmp( SPLOG_INFO, MEMB, "Read_form2: updating Highest_seq %d -> %d; Aru %d -> %d based on token contents (Last_discarded %d, My_aru %d)\n",
+                Highest_seq, my_rg_info->highest_seq, Aru, my_rg_info->aru, Last_discarded, My_aru );
 
-	Highest_seq = my_rg_info->highest_seq;
-	Aru	    = my_rg_info->aru;
+        /* NOTE: forget packets that arrived after this daemon sent its form1 token and aren't reflected on the form2 token at all (i.e. - Highest_seq is higher than token's) */
+
+        for ( ; Highest_seq > my_rg_info->highest_seq; --Highest_seq )
+        {
+                pack_entry = Highest_seq & PACKET_MASK;
+
+                if ( !Packets[ pack_entry ].exist )
+                        continue;
+
+                if ( 1 != Packets[ pack_entry ].exist )
+                        Alarmp( SPLOG_FATAL, MEMB, "Read_form2: dropping %d (> my_rg_info->highest_seq %d), but its .exist (%d) != 1\n",
+                                Highest_seq, my_rg_info->highest_seq, Packets[ pack_entry ].exist );
+                                        
+                if ( !Memb_is_equal( Packets[ pack_entry ].head->memb_id, Membership_id ) )
+                        Alarmp( SPLOG_FATAL, MEMB, "Read_form2: dropping %d (> my_rg_info->highest_seq %d), but it's memb_id (0x%08X, %d) is wrong (0x%08X, %d)!\n",
+                                Highest_seq, my_rg_info->highest_seq, Packets[ pack_entry ].head->memb_id.proc_id, Packets[ pack_entry ].head->memb_id.time, 
+                                Membership_id.proc_id, Membership_id.time );
+
+                if ( Packets[ pack_entry ].head->seq != Highest_seq )
+                        Alarmp( SPLOG_FATAL, MEMB, "Read_form2: dropping %d (> my_rg_info->highest_seq %d), but I have an entry for it in Packets, but it's seq (%d) is wrong!\n",
+                                Highest_seq, my_rg_info->highest_seq, Packets[ pack_entry ].head->seq );
+                
+                if ( Conf_proc_by_id_in_conf( &Future_membership, Packets[ pack_entry ].head->proc_id, &p ) != -1 )
+                        Alarmp( SPLOG_FATAL, MEMB, "Read_form2: dropping %d (> my_rg_info->highest_seq %d), but sender (0x%08X) is on the token!\n",
+                                Highest_seq, my_rg_info->highest_seq, Packets[pack_entry].head->proc_id );
+                
+                Alarmp( SPLOG_INFO, MEMB, "Read_form2: Dropping packet %d (> my_rg_info->highest_seq %d) from partitioning member 0x%08X received after sent FORM1!\n", 
+                        Highest_seq, my_rg_info->highest_seq, Packets[ pack_entry ].head->proc_id );
+                
+                Packets[ pack_entry ].exist = 0;
+                dispose( Packets[ pack_entry ].head );
+                dispose( Packets[ pack_entry ].body );
+        }
+
+        if ( My_aru > my_rg_info->highest_seq )
+        {
+                Alarmp( SPLOG_INFO, MEMB, "Read_form2: updating My_aru %d -> %d (my_rg_info->highest_seq)\n", My_aru, my_rg_info->highest_seq );
+                My_aru = my_rg_info->highest_seq;
+        }
+
+	Highest_seq = my_rg_info->highest_seq;  /* above loop already lowered Highest_seq as necessary; other daemons can raise Highest_seq through token */
+	Aru	    = my_rg_info->aru;          /* other daemons should only lower Aru through token */
+        
         /* Note: this call to Discard_packets handles delivery of all the messages
          *       from the old membership with sequence numbers prior to the old Aru.
          */
@@ -2212,6 +2256,10 @@
 
 		if( Packets[pack_entry].exist != 0 )
                 {
+                        if ( 1 != Packets[ pack_entry ].exist )
+                                Alarmp( SPLOG_FATAL, MEMB, "Read_form2: %d is a hole on token, but I have it, but its .exist (%d) != 1\n",
+                                        *my_holes_procs_ptr, Packets[ pack_entry ].exist );
+
                         if ( !Memb_is_equal( Packets[pack_entry].head->memb_id, Membership_id ) )
                                 Alarmp( SPLOG_FATAL, MEMB, "Read_form2: %d is a hole on token, but I have it, but it's memb_id (0x%08X, %d) is wrong (0x%08X, %d)!\n",
                                         *my_holes_procs_ptr, Packets[pack_entry].head->memb_id.proc_id, Packets[pack_entry].head->memb_id.time, 
@@ -2231,7 +2279,7 @@
                          * consistent across all daemons, all who did get it must now forget it.  This won't
                          * violate any form of self delivery because the originator is not in this attempt. */
 
-                        Alarmp( SPLOG_WARNING, MEMB, "Read_form2: WARNING!!! Dropping packet %d from partitioning member 0x%08X received after FORM1 processed!\n", 
+                        Alarmp( SPLOG_INFO, MEMB, "Read_form2: Dropping packet %d from partitioning member 0x%08X received after FORM1 processed!\n", 
                                 *my_holes_procs_ptr, Packets[pack_entry].head->proc_id );
 
                         dispose( Packets[pack_entry].head );
@@ -2242,6 +2290,41 @@
 		my_holes_procs_ptr++;
 	}
 
+        /* recompute My_aru and validate .exist across (Last_discarded, Highest_seq]; NOTE: above dropping of packets recorded as holes could require lowering My_aru */
+
+        for ( my_aru = i = Last_discarded, my_aru2 = My_aru; ++i <= Highest_seq; )
+        {
+                switch ( Packets[ i & PACKET_MASK ].exist )
+                {
+                case 1:
+                case 2:
+                        if ( i == my_aru + 1 )
+                                my_aru = i;
+                        break;
+
+                case 0:
+                case 3:
+                        if ( my_aru2 >= i )
+                                my_aru2 = i - 1;
+                        break;
+
+                default:
+                        Alarmp( SPLOG_FATAL, MEMB, "Read_form2: Unexpected .exist (%d) at seq %d; Last_discarded (%d); Highest_seq (%d)\n",
+                                Packets[ i & PACKET_MASK ].exist, i, Last_discarded, Highest_seq );
+                        break;
+                }
+        }
+
+        if ( my_aru != my_aru2 )
+                Alarmp( SPLOG_FATAL, MEMB, "Read_form2: unexpected My_aru (%d) value based off of Last_discarded (%d), Highest_seq (%d) and Packets[].exist; (my_aru %d, my_aru2 %d)\n",
+                        My_aru, Last_discarded, Highest_seq, my_aru, my_aru2 );
+
+        if ( my_aru != My_aru )
+        {
+                Alarmp( SPLOG_INFO, MEMB, "Read_form2: updating My_aru %d -> %d based off of Packets (probably due to dropping packets from partitioning members)\n", My_aru, my_aru );
+                My_aru = my_aru;
+        }
+
 	/* extract future commit set (and future trans membership) */
 	Future_commit_set.num_members = my_rg_info->num_commit;
 	Future_commit_set.num_pending = my_rg_info->num_trans;
@@ -2488,11 +2571,10 @@
 static	void	Backoff_membership( void )
 {
 	int	pack_entry;
-	int	i;
+	int32	i;
 
 	Alarmp( SPLOG_INFO, MEMB, "Backoff_membership entered: Last_discarded = %d; Highest_seq = %d; Aru = %d; My_aru = %d\n", Last_discarded, Highest_seq, Aru, My_aru );
 
-	pack_entry=-1;
 	for( i=Last_discarded+1; i <= Highest_seq; i++ )
 	{
 		/* clear dummy messages */

Modified: branches/work_4_4_1/daemon/protocol.c
===================================================================
--- branches/work_4_4_1/daemon/protocol.c	2018-03-28 01:53:48 UTC (rev 895)
+++ branches/work_4_4_1/daemon/protocol.c	2018-03-28 05:00:40 UTC (rev 896)
@@ -1516,7 +1516,7 @@
 {
         int             pack_entry;
         int             end_seq;
-        int             i;
+        int32           i;
 
         if ( Memb_state() == EVS ) return;
         if ( Prot_delivery_threshold > RELIABLE_TYPE ) return;
@@ -1550,7 +1550,7 @@
         /* deliver all non-safe packets that are ordered and not delivered */
 
         int             pack_entry;
-        int             i;
+        int32           i;
 
         if ( My_aru <= Last_delivered ) return;
         if ( Memb_state() == EVS ) return;
@@ -1590,7 +1590,7 @@
         packet_body     *body_ptr;
         up_queue        *up_ptr;
         int             proc_index;
-        int             i;
+        int32           i;
 
         if ( Aru <= Last_discarded ) return;
         if ( Memb_state() == EVS )




More information about the Spread-cvs mailing list