-
Tatiana Azundris Nuernberg authored
Error codes should now be in certain ranges according to their use, e.g. messages intended to be sent to the client are expected in the range below 10,000, while messages intended for the error-log are expected in the range starting at 10,000, and so on. A number of messages were recently added in unsuitable ranges. This patch therefore endeavors to achieve three things: - Provide an assert() in the function reporting to the client that will error out if the provided error-code is in the server-range. (An assertion already existed, but let pass the aforementioned false negatives. This patch fixes that.) This is considered a workable solution as code that reports to the client is as a rule expected to cover those code paths in the test suite. - Move the messages in question to the correct ranges. - Provide a simple utility that scans source files for calls to LogErr() / LogEvent() (the server's calls to the error-logger), extracts the symbols for any calls found, and looks up those symbols to make sure they exist and are in the correct range. The reasoning here is that test coverage for paths involving the error logger is lower than for messages to the client (as the situations that result in these message are often hard to trigger without DBUG_EXECUTE_IF / @@session.debug, such as out of memory situations). While the tool was originally written to ensure that all mis-categorized log-messages were covered in this patch, it is provided here for optional use by individual engineers, or for adding to the repository's hook. Approved by: Jens Even <jens.even.blomsoy@oracle.com>
Tatiana Azundris Nuernberg authoredError codes should now be in certain ranges according to their use, e.g. messages intended to be sent to the client are expected in the range below 10,000, while messages intended for the error-log are expected in the range starting at 10,000, and so on. A number of messages were recently added in unsuitable ranges. This patch therefore endeavors to achieve three things: - Provide an assert() in the function reporting to the client that will error out if the provided error-code is in the server-range. (An assertion already existed, but let pass the aforementioned false negatives. This patch fixes that.) This is considered a workable solution as code that reports to the client is as a rule expected to cover those code paths in the test suite. - Move the messages in question to the correct ranges. - Provide a simple utility that scans source files for calls to LogErr() / LogEvent() (the server's calls to the error-logger), extracts the symbols for any calls found, and looks up those symbols to make sure they exist and are in the correct range. The reasoning here is that test coverage for paths involving the error logger is lower than for messages to the client (as the situations that result in these message are often hard to trigger without DBUG_EXECUTE_IF / @@session.debug, such as out of memory situations). While the tool was originally written to ensure that all mis-categorized log-messages were covered in this patch, it is provided here for optional use by individual engineers, or for adding to the repository's hook. Approved by: Jens Even <jens.even.blomsoy@oracle.com>
Loading