Skip to content

Commit

Permalink
alter: add an assert in _cluster replace for old tuple
Browse files Browse the repository at this point in the history
_cluster on-replace trigger parses old and new tuples into
replica_def objects. One path handles the case of new_def != NULL.
The other assumes that old_def != NULL if new_def was NULL. This
is correct, because replace wouldn't happen if both tuples are
NULL. It would mean nothing changed.

Nonetheless coverity complained here that the old tuple could be
NULL even if the new one was NULL. The patch silences this warning
by adding an assert.

NO_DOC=refactor
NO_CHANGELOG=refactor
NO_TEST=not testable
  • Loading branch information
Gerold103 authored and sergepetrenko committed Aug 15, 2023
1 parent 2fc0557 commit 3209f54
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/box/alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4620,6 +4620,7 @@ on_replace_dd_cluster(struct trigger *trigger, void *event)
return on_replace_dd_cluster_update(old_def, new_def);
return on_replace_dd_cluster_insert(new_def);
}
assert(old_def != NULL);
return on_replace_dd_cluster_delete(old_def);
}

Expand Down

0 comments on commit 3209f54

Please sign in to comment.