Skip to content

Commit

Permalink
VSR/Replica: Evict client with new version
Browse files Browse the repository at this point in the history
  • Loading branch information
sentientwaffle committed Mar 8, 2024
1 parent 293e2f2 commit 8061745
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/vsr/message_header.zig
Expand Up @@ -1185,6 +1185,7 @@ pub const Header = extern struct {
reserved = 0,
no_session = 1,
version_too_low = 2,
version_too_high = 3,

comptime {
for (std.enums.values(Reason), 0..) |reason, index| {
Expand Down
11 changes: 11 additions & 0 deletions src/vsr/replica.zig
Expand Up @@ -4373,6 +4373,17 @@ pub fn ReplicaType(
return true;
}

if (message.header.release > self.release) {
log.warn("{}: on_request: ignoring invalid version (client={} version={}>{})", .{
self.replica,
message.header.client,
message.header.release,
self.release,
});
self.send_eviction_message_to_client(message.header.client, .version_too_high);
return true;
}

if (!message.header.operation.valid(StateMachine)) {
// Some possible causes:
// - client bug
Expand Down

0 comments on commit 8061745

Please sign in to comment.