Details

    • Task
    • Status: Stalled (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      Automatic re-discover is supported as a feature, but currently it is only allowed when a table is being opened. Because of table definition cache tables are rarely opened, instead, open tables are put in the TDC for reuse without reopening.

      Thus an engine must either block all table changes while the table is opened - that is, for undefined amount of time, because the engine cannot force the table to be closed, it can only wait for the user to issue FLUSH TABLES.

      Or the engine should issue a HA_ERR_TABLE_DEF_CHANGED after the table was opened - it will cause an error message sent to the user "table definition was changed, need re-discovery".

      We need to allow automatic re-discover to happen more often. Options:

      • every time a table is taken from the TDC, the server calls a new special method "is the table definition up-to-date"?
      • on HA_ERR_TABLE_DEF_CHANGED error from the external_lock() the server does fallback-and-retry, just as when it gets this error from open().

      Attachments

        Issue Links

          Activity

            about the external_lock() approach:

            • it's up to the engine to ensure that the table definition doesn't change if the table is external_lock'ed. If the table definition still changes, we issue an error.
            • Our the use case is — a table is taken from the table cache. Nobody has external_lock'ed it yet.
            • So, when we do external_lock() and get HA_ERR_TABLE_DEF_CHANGED in return, we can expect that probably nobody else is using this table at the moment.
            • We have some kind of the metadata lock on this table.
            • Ask MDL subsystem to upgrade it to the exclusive lock or fail immediately if it's impossible (there is a conflicting lock on the table).
            • This breaks the strict locking order, but because it never waits (instead it fails at once), this can never cause deadlocks.
            • in most cases it should not fail — if it does, it means that somebody is using the table, so this somebody's external_lock should have prevented the table definition from being changed, and we should not have got HA_ERR_TABLE_DEF_CHANGED in the first place
            • if it still fails — return an error to the user, as before
            • if we got our exclusive metadata lock, we can close and reopen the table.
            • same logic should be used inside open_table(), instead of backoff-and-retry.
            serg Sergei Golubchik added a comment - about the external_lock() approach: it's up to the engine to ensure that the table definition doesn't change if the table is external_lock'ed. If the table definition still changes, we issue an error. Our the use case is — a table is taken from the table cache. Nobody has external_lock'ed it yet. So, when we do external_lock() and get HA_ERR_TABLE_DEF_CHANGED in return, we can expect that probably nobody else is using this table at the moment. We have some kind of the metadata lock on this table. Ask MDL subsystem to upgrade it to the exclusive lock or fail immediately if it's impossible (there is a conflicting lock on the table). This breaks the strict locking order, but because it never waits (instead it fails at once), this can never cause deadlocks. in most cases it should not fail — if it does, it means that somebody is using the table, so this somebody's external_lock should have prevented the table definition from being changed, and we should not have got HA_ERR_TABLE_DEF_CHANGED in the first place if it still fails — return an error to the user, as before if we got our exclusive metadata lock, we can close and reopen the table. same logic should be used inside open_table(), instead of backoff-and-retry.

            People

              serg Sergei Golubchik
              serg Sergei Golubchik
              Votes:
              4 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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