Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4681

Fix install_mcs_mysql.sh.in to do CREATE FUNCTION instead of INSERT INTO mysql.func

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.1.1
    • Component/s: installation
    • Labels:
      None
    • Sprint:
      2021-9

      Description

      install_mcs_mysql.sh.in currently uses direct INSERTs to populate mysql.func, e.g.:

      ...
      INSERT INTO mysql.func VALUES ('mcssystemready',2,'ha_columnstore.so','function');
      INSERT INTO mysql.func VALUES ('mcssystemreadonly',2,'ha_columnstore.so','function');
      INSERT INTO mysql.func VALUES ('mcssystemprimary',2,'ha_columnstore.so','function');
      INSERT INTO mysql.func VALUES ('regr_avgx',1,'libregr_mysql.so','aggregate');
      INSERT INTO mysql.func VALUES ('regr_avgy',1,'libregr_mysql.so','aggregate');
      INSERT INTO mysql.func VALUES ('regr_count',2,'libregr_mysql.so','aggregate');
      ...
      

      This is a not good way to install UDFs and UDAFs:

      • There is no a guaratee that the structure of mysql.func will always be the same.
      • This approach needs to restart the MariaDB server to make the functions actually available. This makes ColumnStore post-installation step unnecessarily more complex.

      The correct way to install UDFs and UDAFs it to use CREATE FUNCTION and CREATE AGGREGATE FUNCTION statements.

      ...
      CREATE OR REPLACE FUNCTION mcssystemready RETURNS INTEGER SONAME 'ha_columnstore.so';
      CREATE OR REPLACE FUNCTION mcssystemreadonly RETURNS INTEGER SONAME 'ha_columnstore.so';
      CREATE OR REPLACE FUNCTION mcssystemprimary RETURNS INTEGER SONAME 'ha_columnstore.so';
      CREATE OR REPLACE AGGREGATE FUNCTION regr_avgx RETURNS REAL SONAME 'libregr_mysql.so';
      CREATE OR REPLACE AGGREGATE FUNCTION regr_avgy RETURNS REAL SONAME 'libregr_mysql.so';
      CREATE OR REPLACE AGGREGATE FUNCTION regr_count RETURNS INTEGER SONAME 'libregr_mysql.so';
      ...
      

      • It's safe about mysql.func structure changes
      • It does not need the server restart. Functions become immediately available.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dleeyh Daniel Lee
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration