Bug #77021 ndbrequire() should report actual condition expression like assert() does
Submitted: 13 May 2015 10:37 Modified: 7 Mar 2016 14:18
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S4 (Feature request)
Version:ndb-7.4.4; any OS:Any
Assigned to: CPU Architecture:Any

[13 May 2015 10:37] Hartmut Holzgraefe
Description:
The assert() macro prints an error message that includes the failed assertion expression, e.g.:

  foo: foo.c:5: main: Assertion `1==0' failed.

ndbrequire(), which has a purpose similar to assert() in that it tests a given expression and terminates the process if the expression doesn't evaluate to true,
does not preserve this precious information, the cluster and error log entries it causes does tell the file name and line number, but not the expression, e.g.:

  Status: Temporary error, restart node
  Message: Internal program error (failed ndbrequire) (Internal error,   
    programming error or missing error message, please report a bug)
  Error: 2341
  Error data: dbacc/DbaccMain.cpp
  Error object: DBACC (Line: ....) 0x0000000a
  Program: ndbd

How to repeat:
Check any cluster error log that contains "Internal program error (failed ndbrequire)" entries 

Suggested fix:
Include the actual expression in the ndbrequire() output
[21 May 2015 13:21] MySQL Verification Team
Hello Hartmut,

Thank you for the feature request!

Thanks,
Umesh
[7 Mar 2016 14:18] Jon Stephens
Documented fix in the NDB 7.5.2 changelog as follows:

    The internal function ndbrequire(), which, like assert(),
    evaluates a given expression and terminates the process if the
    expression does not evaluate to true, now includes the failed 
    expression in its output to the error logs.

Closed.