MySQL 8.0.32
Source Code Documentation
Use of ndbrequire

In the NDB kernel code, the ndbrequire() facility has historically been widely used.

However, most of this is now considered misuse, and use of ndbrequire() should generally be avoided. Over time, we want to remove most or all ndbrequire() instances.

There are three different classes of ndbrequire() usage, with corresponding replacement as follows:

  • Verification of code logic: Hitting this is a real bug, and the error message should be written accordingly. For this use, one option is ndbassert() (only enabled in debug builds), or we might need to add ndbchecklogic() or similar.
  • Hitting a configurable limit, which cannot be handled gracefully: For this, use ndbrequireErr(). The error message should suggest a configuration change to correct the problem, or refer to a section in the manual for more information.
  • Hitting hardcoded limits: We should really try to avoid this, but if it is unavoidable, or if it is a limit we think we will never hit, use ndbrequireErr() and add an appropriate error message.