Bug #47502 | require() defined multiple times in storage/ndb | ||
---|---|---|---|
Submitted: | 22 Sep 2009 3:11 | Modified: | 10 Dec 2009 6:26 |
Reporter: | jack andrews | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S3 (Non-critical) |
Version: | mysql-5.1-telco-7.0 | OS: | Any |
Assigned to: | jack andrews | CPU Architecture: | Any |
[22 Sep 2009 3:11]
jack andrews
[22 Sep 2009 3:55]
jack andrews
Index: bug45447/storage/ndb/include/ndb_global.h.in =================================================================== --- bug45447.orig/storage/ndb/include/ndb_global.h.in 2009-07-06 21:46:50.000000000 +1000 +++ bug45447/storage/ndb/include/ndb_global.h.in 2009-09-22 13:37:49.972000000 +1000 @@ -165,4 +165,23 @@ #define NDB_ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +//used by the always* macros. behaves just like require +inline void +_always(long long v, int retval, const char* expr, const char* file, int line) +{ + if (likely(v)) + return; + fprintf(stderr, "%s:%d: always('%s') failed\n", file, line, expr); + fflush(stderr); + if (!retval) + abort(); + exit(retval); +} + +//always_or_exit exits if v is zero. if v is zero and retval is zero, it aborts +#define always_or_exit(v, retval) _always((long long)(v), retval, #v, __FILE__, __LINE__) + +//always aborts if v is zero +#define always(v) always_or_exit((v), 0) + #endif
[22 Sep 2009 3:56]
jack andrews
see previous comment for the patch
[22 Sep 2009 8:36]
jack andrews
sorry, left out {} for if statements: Index: bug45447/storage/ndb/include/ndb_global.h.in =================================================================== --- bug45447.orig/storage/ndb/include/ndb_global.h.in 2009-09-22 17:30:14.392000000 +1000 +++ bug45447/storage/ndb/include/ndb_global.h.in 2009-09-22 18:34:53.029000000 +1000 @@ -165,4 +165,25 @@ #define NDB_ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +//used by the always* macros. behaves just like require +inline void +_always(long long v, int retval, const char* expr, const char* file, int line) +{ + if (likely(v)){ + return; + } + fprintf(stderr, "%s:%d: always('%s') failed\n", file, line, expr); + fflush(stderr); + if (!retval){ + abort(); + } + exit(retval); +} + +//always_or_exit exits if v is zero. if v is zero and retval is zero, it aborts +#define always_or_exit(v, retval) _always((long long)(v), retval, #v, __FILE__, __LINE__) + +//always aborts if v is zero +#define always(v) always_or_exit((v), 0) + #endif
[1 Dec 2009 1:21]
jack andrews
just a bump -- posted a new patch to dev-ndb@
[4 Dec 2009 5:56]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/92822 3255 jack andrews 2009-12-04 bug #47502 - centralize require() . removes the warning for slow_select . adds ndbout_printer for general use (removed the implementation from DynArr256.cpp) (because slow_select.cpp needs the same utility function)
[10 Dec 2009 6:26]
Jonas Oreland
no docs needed