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

Request: session innodb_file_per_table and innodb_file_format

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a Bug
    • Fix Version/s: 10.0.12
    • Component/s: None
    • Labels:

      Description

      Would it be possible to make innodb_file_per_table and innodb_file_format session variables? Having more than one concurrent thread that may create a table, or even use ALTER TABLE with the COPY algorithm, is unsafe (unless you always use GET_LOCK or some other solution I don't know).

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            jplindst Jan Lindström added a comment -

            Not possible easily because you could already have tables inside a old innodb table space.

            Show
            jplindst Jan Lindström added a comment - Not possible easily because you could already have tables inside a old innodb table space.
            Hide
            jplindst Jan Lindström added a comment -

            It seems that innodb_file_per_table =

            {0|1}

            has been implemented so that you can use table with different values but at the moment only using shutdown. innodb_file_format affects how actual storage of file is interpreted and changing that is not safe. Why you say that creating tables from concurrent threads is unsafe? It should not be, similarly alter table with copy to different tables on different threads should be safe. If not, there is a bug.

            Show
            jplindst Jan Lindström added a comment - It seems that innodb_file_per_table = {0|1} has been implemented so that you can use table with different values but at the moment only using shutdown. innodb_file_format affects how actual storage of file is interpreted and changing that is not safe. Why you say that creating tables from concurrent threads is unsafe? It should not be, similarly alter table with copy to different tables on different threads should be safe. If not, there is a bug.
            Hide
            f_razzoli Federico Razzoli added a comment -

            I'm not sure, probably my explaination was not clear. I'll show an example, so you can judge if what I'm asking makes sense:

            MariaDB [test_innodb]> SET @@global.innodb_file_per_table = OFF;
            Query OK, 0 rows affected (0.01 sec)
            
            MariaDB [test_innodb]> CREATE TABLE uno (a INT PRIMARY KEY) ENGINE = InnoDB;
            Query OK, 0 rows affected (0.28 sec)
            
            MariaDB [test_innodb]> SET @@global.innodb_file_per_table = ON;
            Query OK, 0 rows affected (0.00 sec)
            
            MariaDB [test_innodb]> ALTER TABLE uno FORCE;
            Query OK, 0 rows affected (0.89 sec)               
            Records: 0  Duplicates: 0  Warnings: 0
            

            After CREATE, uno exists in the sys tablespace; after ALTER, it has its own ibd file.

            What I mean by "unsafe" is that thread1 might change innodb_file_per_table immediatly before thread2 ALTERs a table. The only way I know to avoid this is that all threads do things like this every time they ALTER a table:

            SELECT GET_LOCK(...);
            SET innodb_file_per_table = 1;
            SET innodb_file_format = 'Barracuda';
            ALTER ...
            DO RELEASE_LOCK(...);

            ...unless only 1 thread can CREATE/ALTER.

            Does my request make sense?

            Show
            f_razzoli Federico Razzoli added a comment - I'm not sure, probably my explaination was not clear. I'll show an example, so you can judge if what I'm asking makes sense: MariaDB [test_innodb]> SET @@global.innodb_file_per_table = OFF; Query OK, 0 rows affected (0.01 sec) MariaDB [test_innodb]> CREATE TABLE uno (a INT PRIMARY KEY) ENGINE = InnoDB; Query OK, 0 rows affected (0.28 sec) MariaDB [test_innodb]> SET @@global.innodb_file_per_table = ON; Query OK, 0 rows affected (0.00 sec) MariaDB [test_innodb]> ALTER TABLE uno FORCE; Query OK, 0 rows affected (0.89 sec) Records: 0 Duplicates: 0 Warnings: 0 After CREATE, uno exists in the sys tablespace; after ALTER, it has its own ibd file. What I mean by "unsafe" is that thread1 might change innodb_file_per_table immediatly before thread2 ALTERs a table. The only way I know to avoid this is that all threads do things like this every time they ALTER a table: SELECT GET_LOCK(...); SET innodb_file_per_table = 1; SET innodb_file_format = 'Barracuda'; ALTER ... DO RELEASE_LOCK(...); ...unless only 1 thread can CREATE/ALTER. Does my request make sense?
            Hide
            serg Sergei Golubchik added a comment -

            Indeed, one can change innodb_file_per_table at runtime. Which allows to have some tables in their own tablespaces and some other tables — in one big tablespace.

            I'd still expect that doing it per thread would require big changes inside InnoDB, but I let Jan Lindström answer that.

            Show
            serg Sergei Golubchik added a comment - Indeed, one can change innodb_file_per_table at runtime. Which allows to have some tables in their own tablespaces and some other tables — in one big tablespace. I'd still expect that doing it per thread would require big changes inside InnoDB, but I let Jan Lindström answer that.
            Hide
            jplindst Jan Lindström added a comment -

            Desided not to support.

            Show
            jplindst Jan Lindström added a comment - Desided not to support.

              People

              • Assignee:
                jplindst Jan Lindström
                Reporter:
                f_razzoli Federico Razzoli
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: