Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6152

Remove calls to current_thd while creating Item

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Fix Version/s: 10.1.7
    • Component/s: Parser
    • Labels:

      Description

      current_thd() is called many times while creating Items (in many cases 2 or more calls per item).

      The problem is not only the number of calls to current_thd(), but also that when we create items we cause more calls, like calling sql_alloc() that calls current_thd and then uses this to call alloc_root() with the right argumetns.

      By adding thd as an argument to all functions that creates Items, we can avoid most calls to current_thd(). We can also call alloc_root() directly instead of calling it trough sql_alloc().

      Changes in the code as part of this task:

      • Add THD as an argument to all functions that creates an Item.
      • Replace 'new Item_xxx' with 'new (thd->memroot) Item_xxx
      • Add thd->memroot as an argument to push_back() and push_front() for lists.

      Before adding this to 10.1 code base, we need to benchmark the result to see that this big change is really worth it.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              monty Michael Widenius added a comment -

              Pushed into 10.1

              Show
              monty Michael Widenius added a comment - Pushed into 10.1

                People

                • Assignee:
                  monty Michael Widenius
                  Reporter:
                  monty Michael Widenius
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 1 week
                    1w
                    Remaining:
                    Remaining Estimate - 2 days
                    2d
                    Logged:
                    Time Spent - Not Specified Time Not Required
                    Not Specified

                      Agile