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

make lf_hash_delete(), lf_hash_search(), and lf_hash_iterator() never to return OOM

Details

    • Task
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.1.3
    • OTHER
    • None

    Description

      When lf_delete() — for example — searches in the hash it may need to allocate and insert a new dummy node, the latter may fail with OOM. The caller normally doesn't expect OOM from searches or deletes and it's not always easy to handle OOM there.

      Instead lf_delete() and lf_search() can be changed never to return OOM. Indeed, when a search cannot insert a new dummy node, it simply needs to start searching from the previous dummy node, which is guaranteed to exist.

      It's even easier in lf_hash_iterate() — it only ever looks for the very first bucket, dummy node 0. If that node does not exists, the hash is most certainly empty.

      Attachments

        Activity

          serg Sergei Golubchik created issue -
          serg Sergei Golubchik made changes -
          Field Original Value New Value
          Fix Version/s 10.1 [ 16100 ]
          serg Sergei Golubchik made changes -
          Priority Major [ 3 ] Critical [ 2 ]
          serg Sergei Golubchik made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          serg Sergei Golubchik added a comment - - edited

          svoj, please, take a look at the patch.

          https://github.com/MariaDB/server/tree/bb-lf-no-oom

          serg Sergei Golubchik added a comment - - edited svoj , please, take a look at the patch. https://github.com/MariaDB/server/tree/bb-lf-no-oom
          serg Sergei Golubchik made changes -
          Assignee Sergei Golubchik [ serg ] Sergey Vojtovich [ svoj ]
          Status Stalled [ 10000 ] In Review [ 10002 ]

          It looks very good, thanks for implementing!

          I just have one more wish (better to be implemented separately): make lf_hash_get_pins() never to return OOM.

          One way to solve this is to allow to preallocate max possible number of pins (e.g. table cache doesn't need more pins than max_connections?).

          Another way is to have static pins protected by mutex. They will be returned on OOM only.

          svoj Sergey Vojtovich added a comment - It looks very good, thanks for implementing! I just have one more wish (better to be implemented separately): make lf_hash_get_pins() never to return OOM. One way to solve this is to allow to preallocate max possible number of pins (e.g. table cache doesn't need more pins than max_connections?). Another way is to have static pins protected by mutex. They will be returned on OOM only.
          svoj Sergey Vojtovich made changes -
          Status In Review [ 10002 ] Stalled [ 10000 ]
          svoj Sergey Vojtovich made changes -
          Assignee Sergey Vojtovich [ svoj ] Sergei Golubchik [ serg ]
          serg Sergei Golubchik made changes -
          Component/s OTHER [ 10125 ]
          Fix Version/s 10.1.3 [ 18000 ]
          Fix Version/s 10.1 [ 16100 ]
          Resolution Fixed [ 1 ]
          Status Stalled [ 10000 ] Closed [ 6 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 59003 ] MariaDB v3 [ 65727 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 65727 ] MariaDB v4 [ 132491 ]

          People

            serg Sergei Golubchik
            serg Sergei Golubchik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.