hycdong commented on PR #1065:
URL: 
https://github.com/apache/incubator-pegasus/pull/1065#issuecomment-1189966173

   > I found before `duplicating` field is, before:
   > 
   > ```
   > 12:optional bool duplicating;
   > ```
   > 
   > after:
   > 
   > ```
   > 12:optional bool duplicating = false;
   > ```
   > 
   > Because it's `optional`, the `operator ==` of `app_info` will check 
whether this filed is set or not at first, like:
   > 
   > ```
   >     if (__isset.duplicating != rhs.__isset.duplicating)
   >       return false;
   >     else if (__isset.duplicating && !(duplicating == rhs.duplicating))
   >       return false;
   > ```
   > 
   > That is to say, if `duplicating` is not set, the default value will not 
take effect, so how does this bug happend?
   
   
   For Pegasus release 2.1.x, 2.2.x and 2.3.x, the duplicating field of 
`app_info` is like: 
   > 12:optional bool duplicating;
   
   It means that when a table is not executing duplication, 
`app_info.__isset.duplicating = false`. 
   However, in the releases version above, `duplicating` field will be set by 
function `on_config_proposal`:
   
https://github.com/apache/incubator-pegasus/blob/42f4eee5b41192145aec1a9b41d9d0f32c7115ce/src/rdsn/src/replica/replica_config.cpp#L95
   
   It will lead to primary and secondaries have inconsistent duplicating value 
when table is not executing duplication. 
   For primary replica -> app_info.__isset.duplicating = false,
   For secondary replica -> app_info.__isset.duplicating = true, 
app_info.duplicating = false.
   
   As result, tables created in 2.1.x, 2.2.x, 2.3.x and not duplicating, they 
will have inconsistent `duplicating` field between replicas, which will lead to 
the bug.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to