Log MySQL Errors#102
Conversation
Improve edge case logic in comparison functions. Remove unregister driver function. Clean up exp_functions.c.
Simplify dataqa_duplicates component in preparation for making it the boundary into our new duplicate system. Add exp functions: sparse_eql(), ln(), and logn(). Fix bugs in comparison functions. Make minor tweaks to objdrv_cluster.c.
Modify cluster files to use string keys. Build vectors fully sparsely. Add ca_fprint_vector(). Add snprint_llu(). Add exp_fn_trim(). Update exp_fn_cmp(). Organize exp function definitions by group. Add statistics tracking to cluster driver. Reduce minimum hint threshold. Add array handling to ci_xaToTrimmedArray(). Update timer to handle multiple starts and stops properly.
Re-add Levenshtein to exp_functions. Publish edit_dist() in the cluster library. Fix mistakes in cluster driver function signatures. Fix spelling mistakes. Add detail to an error message in the lexer. Remove unused .cluster files. Clean up cluster-schema.cluster. Clean up other unused junk.
Add known issues to string similarity documentation. Clean up and organize todos. Clean up testing code in several files.
…ast commit). Update tests to pass with this modification.
… caches). Fix a formatting issue with the stat method. Fix a missing include in the util.c library.
…le hundred bytes. Add check_double() to handle functions that return NAN on failure. Clean up.
…rary. Round similarity results to avoid floating point errors. Enable caching for memory allocated in get_cluster_size(). Rename edit_dist() to ca_edit_dist() to match format for public functions. Rename print_diagnostics() to print_err().
Fix a possible uninitialized read. Fix memset() not initializing data.
Improve documentation.
Remove test function.
Modify magic functions to print errors to stderr instead of stdout. Add explicit tree->Alloc = 0; to some exp_functions. Add error checking. Add consts. Re-add typecasts that I thought were optional. Improve comments. Clean up.
Add some error checking. Add expect.h to mtask.c. Add recursion checking.
Add HAVE_BUILTIN_EXPECT to config.h.in and cxlibconfig.h.in. Add code to include cxlibconfig.h.in from expect.h. Add comments to explain what each .h.in file is used for. Remove checks for __builtin_expect() from centrallix because we only need them in centrallix-lib. Remove cflags -DHAVE_BUILTIN_EXPECT because using configs is better. Rebuild configure files.
Fix errors from mysql_query() being ignored. Fix errors from mysql_store_result() being ignored. Fix errors from mysql_real_escape_string() being ignored. Fix "errors" pretending to be warnings. Fix error-propagation failures. Fix errors not being marked as resolved. Fix errors being cleared when they weren't resolved. Fix formatting mistakes. Add more error messages. Add expect to reduce performance hit from checking for errors.
|
@greptileai Please review this PR. |
Greptile SummaryThis PR improves error visibility in the MySQL object driver by propagating previously-ignored failures from
Confidence Score: 5/5The changes are additive error-logging improvements; the DML NULL-result regression flagged in earlier review rounds has been fixed, and no new data-path logic was introduced. All previously identified correctness issues were addressed in prior review rounds. The remaining findings are style-level: a dead variable, a misleading goto label, and a pointer-to-integer-literal comparison. The core control flow is correct. centrallix/osdrivers/objdrv_mysql.c and centrallix-lib/src/mtsession.c carry the bulk of the functional change and are worth a final read-through.
|
| Filename | Overview |
|---|---|
| centrallix/osdrivers/objdrv_mysql.c | Core change: adds mssError calls after previously-silent failures, fixes DML NULL-result handling, introduces goto-based cleanup, and checks mysql_real_escape_string return value. A dead variable and a misleading goto label remain; functionally the logic is correct. |
| centrallix-lib/src/mtsession.c | mssError rewritten: return type changed from int to void, custom format parser replaced with vsnprintf into a fixed BUFSIZ buffer, session list handling preserved. |
| centrallix-lib/include/mtsession.h | Declaration of mssError updated from int to void to match the new implementation; no other functional changes. |
| centrallix-lib/include/util.h | Adds check/check_neg/check_ptr/check_double diagnostic macros, min/max via GCC statement expressions, Timer API, and formatting utilities; all wrapped with appropriate include guards. |
| centrallix-lib/src/util.c | Implements the new utilities declared in util.h; all additions are additive and do not touch existing strtoi/strtoui logic. |
| centrallix-lib/include/expect.h | Adds conditional inclusion of cxlibconfig.h so HAVE_BUILTIN_EXPECT is available; reformats existing LIKELY/UNLIKELY macros with no logic change. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["mysd_internal_RunQuery_conn_va()"] --> B["Build query string\n(SafeAppend for each param)"]
B -- "SafeAppend fails" --> ERR1["mssError(1) escape error\ngoto error"]
B -- "Success" --> C["mysql_query()"]
C -- "Returns != 0" --> ERR2["mssError(1) query error\ngoto query_error"]
C -- "Returns 0" --> D["mysql_store_result()"]
D --> E{"mysql_errno() != 0?"}
E -- "Yes (real error)" --> ERR3["mssError(1) store error\nfree result\ngoto error"]
E -- "No (DML = NULL is OK)" --> F["rval = query_result\ngoto cleanup"]
ERR1 --> CLEANUP
ERR2 --> CLEANUP["cleanup:\nif rval == ERROR\n mssError(0) context msg\nxsDeInit(query)\nreturn rval"]
ERR3 --> CLEANUP
F --> CLEANUP
CLEANUP --> G["Return MYSD_RUNQUERY_ERROR\nor valid MYSQL_RES*"]
Reviews (6): Last reviewed commit: "Remove more error messages that might co..." | Re-trigger Greptile
|
@greptileai Please re-review this PR. Any other issues? Let me know if it looks good. |
|
Warning: This PR is blocked behind the following PRs. Please review them first and review this PR after they have been merged into master so that their changes will not appear in the diff for this PR. We should rebase this branch before merging to clean up merge commit mayhem. |
|
This PR is ready for human review (after the blockers are resolved). |
This PR will improve error handling in the MySQL driver by making the following changes:
Useful C MySQL lib docs: