| Bug #80155 | Logical error in Dbacc::placeWriteInLockQueue | ||
|---|---|---|---|
| Submitted: | 26 Jan 2016 14:27 | Modified: | 28 Jan 2016 11:34 |
| Reporter: | Magnus Blåudd | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S2 (Serious) |
| Version: | 7.2.23 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[28 Jan 2016 11:34]
Jon Stephens
Documented fix in the NDB 7.4.11 and 7.5.1 changelogs as follows:
A logic error in an if statement in
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp rendered
useless a check for determining whether ZREAD_ERROR should be
returned when comparing operations. This was detected when
compiling with -Werror=logical-op.
Closed.

Description: Seems to be a logical error in an if statement in Dbacc which renders a check for if ZREAD_ERROR should be returned useless. Compiler warning generated: storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp:2044: error: logical 'and' of mutually exclusive tests is always false [-Werror=logical-op] if (lop == ZDELETE && (op == ZUPDATE && op == ZDELETE)) ^ How to repeat: Detected when compiling NDB with MySQL 5.8 which has -Werror=logical-op turned on. Suggested fix: Most likely the check should be if op is delete or update, not and. diff --git a/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp b/storage/ndb/src/kernel/b index df918a2..01fa340 100644 --- a/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp +++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp @@ -2041,7 +2041,7 @@ checkop: return ZREAD_ERROR; } #else - if (lop == ZDELETE && (op == ZUPDATE && op == ZDELETE)) + if (lop == ZDELETE && (op == ZUPDATE || op == ZDELETE)) { jam(); return ZREAD_ERROR;