Details
-
Task
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
Description
Remove the following pattern that can be seen anywhere in the Spider codebase.
if (str->reserve(SPIDER_SQL_WHERE_LEN)) |
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
|
This makes the code less readable and is error-prone (e.g., MDEV-27184).
Attachments
Issue Links
- relates to
-
MDEV-27184 Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed, Assertion `str.alloced_length() >= str.length() + data_len' failed
-
- Closed
-
-
MDEV-26384 Spider: add new query building helper function
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue relates to |
Description |
We do see the following anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., Replace the member functions of {{spider_string}}, which need the manual memory allocation, by the functions that automatically allocate memory. |
We do see the following anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., Replace the implementation of the {{spider_string}} member functions, which need the manual memory allocation, by the functions that automatically allocate memory. Then, we can gradually replace the replaced ones with their smart counterpart. |
Summary | Spider: stop using spider_string::reserve(uint32 space_needed) | Deprecate spider_string member functions assuming manual memory allocation |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.7 [ 24805 ] | |
Fix Version/s | 10.8 [ 26121 ] |
Description |
We do see the following anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., Replace the implementation of the {{spider_string}} member functions, which need the manual memory allocation, by the functions that automatically allocate memory. Then, we can gradually replace the replaced ones with their smart counterpart. |
We do see the following anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., Replace the implementation of the {{spider_string}} member functions, which need the manual memory allocation, by their corresponding functions that automatically allocate memory. Then, we can gradually replace the replaced ones with their smart correspondences. |
Description |
We do see the following anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., Replace the implementation of the {{spider_string}} member functions, which need the manual memory allocation, by their corresponding functions that automatically allocate memory. Then, we can gradually replace the replaced ones with their smart correspondences. |
We do see the following anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., Replace the implementation of the {{spider_string}} member functions, which need the manual memory allocation, by their corresponding functions that automatically allocate memory. Then, we can gradually replace the old functions with their smart correspondences. |
Link |
This issue relates to |
Description |
We do see the following anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., Replace the implementation of the {{spider_string}} member functions, which need the manual memory allocation, by their corresponding functions that automatically allocate memory. Then, we can gradually replace the old functions with their smart correspondences. |
We do see the following anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., Replace the implementation of the {{spider_string}} member functions, which need the manual memory allocation, by their corresponding smart functions that automatically allocate memory. Then, we can gradually replace the old functions with their smart correspondences. |
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Stalled [ 10000 ] |
Summary | Deprecate spider_string member functions assuming manual memory allocation | Spider: remove pattern str->reserve() then str->q_append() |
Description |
We do see the following anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., Replace the implementation of the {{spider_string}} member functions, which need the manual memory allocation, by their corresponding smart functions that automatically allocate memory. Then, we can gradually replace the old functions with their smart correspondences. |
Remove the following pattern that can be seen anywhere in the Spider codebase.
{code:cpp} if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); {code} This makes the code less readable and is error-prone (e.g., |
Fix Version/s | 10.9 [ 26905 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.7 [ 24805 ] | |
Fix Version/s | 10.8 [ 26121 ] |
Link |
This issue includes |
Link |
This issue includes |
Fix Version/s | 10.10 [ 27530 ] | |
Fix Version/s | 10.9 [ 26905 ] |
Fix Version/s | 10.11 [ 27614 ] | |
Fix Version/s | 10.10 [ 27530 ] |
Assignee | Nayuta Yanagisawa [ JIRAUSER47117 ] | Yuchen Pei [ JIRAUSER52627 ] |
that'd be str->append(). q_append() means "quick append" that doesn't check if there's enough space and assumes the caller knows what he's doing. Invoking reserve() explicitly every time before q_append() makes little sense, one can just as well use append().