Details

    • Task
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 10.7.1
    • Plugins
    • None

    Description

      It'd be useful for some plugins to read/store data from/to server tables.
      So we can provide the service (as it is defined in the Plugin API) with that functionality.
      The functions of that service look exactly as their counterparts from the client library, so users won't be needing extra documentation.
      The decided set of functions is:
      mysql_init
      mysql_real_connect
      mysql_options
      mysql_close
      mysql_real_query
      mysql_affected_rows
      mysql_errno
      mysql_error
      mysql_store_result
      mysql_free_result
      mysql_num_rows
      mysql_num_fields
      mysql_fetch_row
      mysql_fetch_lengths

      So that the plugin can do calls like
      mysql_real_connect();
      mysql_real_query();..
      res= mysql_store_result();
      ...
      and it's supposed to work as it does with the client library. The only addition is the
      MYSQL_CONNECT_LOCAL option. Connection of that sort attaches to the server itself.

      These local queries handled using Server_runnable class model.

      Attachments

        Issue Links

          Activity

              if (mysql_real_query(mysql,
                    STRING_WITH_LEN("CREATE TABLE mysql." HISTORY_DB_NAME
                                    " ( hash varbinary(512),"
                                    " time timestamp default current_time,"
                                    " primary key (hash), index tm (time) )")))
              {
            

            crashes the server on attempt to insert with default time
            and such table:

              if (mysql_real_query(mysql,
                    STRING_WITH_LEN("CREATE TABLE mysql." HISTORY_DB_NAME
                                    " ( hash varbinary(512),"
                                    " time timestamp default current_time,"
                                    " primary key (hash), index tm (time) )")))
              {
            

            inserts 0000-00-00 00:00:00 but according to table definition shoud include current time:

            show create table mysql.reuse_password_check_history;
            Table	Create Table
            reuse_password_check_history	CREATE TABLE `reuse_password_check_history` (
              `hash` varbinary(512) NOT NULL,
              `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
              PRIMARY KEY (`hash`),
              KEY `tm` (`time`)
            ) ENGINE=MyISAM DEFAULT CHARSET=latin1
            

            sanja Oleksandr Byelkin added a comment - if (mysql_real_query(mysql, STRING_WITH_LEN("CREATE TABLE mysql." HISTORY_DB_NAME " ( hash varbinary(512)," " time timestamp default current_time," " primary key (hash), index tm (time) )"))) { crashes the server on attempt to insert with default time and such table: if (mysql_real_query(mysql, STRING_WITH_LEN("CREATE TABLE mysql." HISTORY_DB_NAME " ( hash varbinary(512)," " time timestamp default current_time," " primary key (hash), index tm (time) )"))) { inserts 0000-00-00 00:00:00 but according to table definition shoud include current time: show create table mysql.reuse_password_check_history; Table Create Table reuse_password_check_history CREATE TABLE `reuse_password_check_history` ( `hash` varbinary(512) NOT NULL, `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`hash`), KEY `tm` (`time`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1
            holyfoot Alexey Botchkov added a comment - the implementation proposal for today. https://github.com/mariadb/server/commit/b638b0f515976327c2b11b730747931369101990

            This does not built:

            FAILED: sql/CMakeFiles/sql.dir/sql_plugin.cc.o 
            /usr/bin/c++ -DDBUG_TRACE -DHAVE_CONFIG_H -DHAVE_EVENT_SCHEDULER -DHAVE_OPENSSL -DHAVE_POOL_OF_THREADS -DMYSQL_SERVER -D_FILE_OFFSET_BITS=64 -Iwsrep-lib/include -Iwsrep-lib/wsrep-API/v26 -Iinclude -Isql -Iextra/pcre2/src/pcre2-build -Iextra/pcre2/src/pcre2/src -Itpool -fPIC -g -DENABLED_DEBUG_SYNC -ggdb3 -DSAFE_MUTEX -DSAFEMALLOC -DTRASH_FREED_MEMORY -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Werror -std=gnu++11 -MD -MT sql/CMakeFiles/sql.dir/sql_plugin.cc.o -MF sql/CMakeFiles/sql.dir/sql_plugin.cc.o.d -o sql/CMakeFiles/sql.dir/sql_plugin.cc.o -c sql/sql_plugin.cc
            sql/sql_plugin.cc: In member function ‘virtual bool sys_var_pluginvar::global_update(THD*, set_var*)’:
            sql/sql_plugin.cc:3622:27: error: ‘PLUGIN_VAR_NO_LOCK’ was not declared in this scope; did you mean ‘PLUGIN_VAR_LONGLONG’?
             3622 |   if (plugin_var->flags & PLUGIN_VAR_NO_LOCK)
                  |                           ^~~~~~~~~~~~~~~~~~
                  |                           PLUGIN_VAR_LONGLONG
            sql/sql_plugin.cc:3627:27: error: ‘PLUGIN_VAR_NO_LOCK’ was not declared in this scope; did you mean ‘PLUGIN_VAR_LONGLONG’?
             3627 |   if (plugin_var->flags & PLUGIN_VAR_NO_LOCK)
                  |                           ^~~~~~~~~~~~~~~~~~
                  |                           PLUGIN_VAR_LONGLONG
            [21/106] Building CXX object sql/CMakeFiles/sql.dir/uniques.cc.o
            ninja: build stopped: subcommand failed.
            

            sanja Oleksandr Byelkin added a comment - This does not built: FAILED: sql/CMakeFiles/sql.dir/sql_plugin.cc.o /usr/bin/c++ -DDBUG_TRACE -DHAVE_CONFIG_H -DHAVE_EVENT_SCHEDULER -DHAVE_OPENSSL -DHAVE_POOL_OF_THREADS -DMYSQL_SERVER -D_FILE_OFFSET_BITS=64 -Iwsrep-lib/include -Iwsrep-lib/wsrep-API/v26 -Iinclude -Isql -Iextra/pcre2/src/pcre2-build -Iextra/pcre2/src/pcre2/src -Itpool -fPIC -g -DENABLED_DEBUG_SYNC -ggdb3 -DSAFE_MUTEX -DSAFEMALLOC -DTRASH_FREED_MEMORY -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Werror -std=gnu++11 -MD -MT sql/CMakeFiles/sql.dir/sql_plugin.cc.o -MF sql/CMakeFiles/sql.dir/sql_plugin.cc.o.d -o sql/CMakeFiles/sql.dir/sql_plugin.cc.o -c sql/sql_plugin.cc sql/sql_plugin.cc: In member function ‘virtual bool sys_var_pluginvar::global_update(THD*, set_var*)’: sql/sql_plugin.cc:3622:27: error: ‘PLUGIN_VAR_NO_LOCK’ was not declared in this scope; did you mean ‘PLUGIN_VAR_LONGLONG’? 3622 | if (plugin_var->flags & PLUGIN_VAR_NO_LOCK) | ^~~~~~~~~~~~~~~~~~ | PLUGIN_VAR_LONGLONG sql/sql_plugin.cc:3627:27: error: ‘PLUGIN_VAR_NO_LOCK’ was not declared in this scope; did you mean ‘PLUGIN_VAR_LONGLONG’? 3627 | if (plugin_var->flags & PLUGIN_VAR_NO_LOCK) | ^~~~~~~~~~~~~~~~~~ | PLUGIN_VAR_LONGLONG [21/106] Building CXX object sql/CMakeFiles/sql.dir/uniques.cc.o ninja: build stopped: subcommand failed.

            Problem with timestamp is not solved (branch to check bb-10.7-MDEV-9245-3)

            sanja Oleksandr Byelkin added a comment - Problem with timestamp is not solved (branch to check bb-10.7- MDEV-9245 -3)
            holyfoot Alexey Botchkov added a comment - - edited Proposed patch https://github.com/mariadb/server/commit/eac481629b8e7b85e2ef862198c9f3eab2dd0a47

            People

              holyfoot Alexey Botchkov
              holyfoot Alexey Botchkov
              Votes:
              1 Vote for this issue
              Watchers:
              9 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.