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

CREATE OR REPLACE bypasses S3 restriction for table creation

Details

    Description

      Normally creation of a new table with S3 engine is not allowed.
      However, the modified CREATE OR REPLACE (from MDEV-25292) bypasses it and creates the table.
      If it's intentional, then probably the plain CREATE should be allowed to do it too.

      Either MinIO or credentials to AWS are needed to run S3 tests.
      See suite/s3/suite.pm for how the suite initializes connection parameters, configure your MinIO or AWS accordingly, put the test case into suite/s3 and run from there.
      Alternatively, all S3-related options can be provided from the command line.

      drop table if exists t, t2;
       
      create table t (a int) engine=Aria;
      insert into t values (1),(2);
      alter table t engine=S3;
      --error 1005
      create table t2 (a int) engine=S3;
      --error 1005
      create table t2 like t;
      create or replace table t2 like t;
      show create table t2;
       
      # Cleanup
      drop table if exists t, t2;
      

      bb-10.11-midenok 8e82c973e

      alter table t engine=S3;
      create table t2 (a int) engine=S3;
      ERROR HY000: Can't create table `test`.`t2` (errno: 131 "Command not supported by the engine")
      create table t2 like t;
      ERROR HY000: Can't create table `test`.`t2` (errno: 131 "Command not supported by the engine")
      create or replace table t2 like t;
      show create table t2;
      Table	Create Table
      t2	CREATE TABLE `t2` (
        `a` int(11) DEFAULT NULL
      ) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
      

      Before MDEV-25292, CREATE OR REPLACE would fail with ER_CANT_CREATE_TABLE/131, the same way as both CREATEs.

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            Description Normally creation of a new table with S3 engine is not allowed.
            However, the modified CREATE OR REPLACE (from MDEV-25292) bypasses it and creates the table.
            If it's intentional, then probably the plain CREATE should be allowed to do it too.

            _Either MinIO or credentials to AWS are needed to run S3 tests._
            _See suite/s3/suite.pm for how the suite initializes connection parameters, configure your MinIO or AWS accordingly, put the test case into suite/s3 and run from there._
            _Alternatively, all S3-related options can be provided from the command line._

            {code:sql}
            drop table if exists t, t2;

            create table t (a int) engine=Aria;
            insert into t values (1),(2);
            alter table t engine=S3;
            --error 1005
            create table t2 (a int) engine=S3;
            --error 1005
            create table t2 like t;
            create or replace table t2 like t;
            show create table t2;

            # Cleanup
            drop table if exists t, t2;
            {code}

            {code:sql|title=bb-10.11-midenok 8e82c973e}
            alter table t engine=S3;
            create table t2 (a int) engine=S3;
            ERROR HY000: Can't create table `test`.`t2` (errno: 131 "Command not supported by the engine")
            create table t2 like t;
            ERROR HY000: Can't create table `test`.`t2` (errno: 131 "Command not supported by the engine")
            create or replace table t2 like t;
            show create table t2;
            Table Create Table
            t2 CREATE TABLE `t2` (
              `a` int(11) DEFAULT NULL
            ) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
            {code}

            The difference in behavior appeared with
            {noformat}
            commit 93c8252f02faa8ad8dc5f005e52f1990c29d4a0d (HEAD)
            Author: Aleksey Midenkov
            Date: Wed Aug 31 11:55:04 2022 +0300

                MDEV-25292 Atomic CREATE OR REPLACE TABLE
            {noformat}

            Before it, CREATE OR REPLACE would fail with ER_CANT_CREATE_TABLE/131, the same way as both CREATEs.
            Normally creation of a new table with S3 engine is not allowed.
            However, the modified CREATE OR REPLACE (from MDEV-25292) bypasses it and creates the table.
            If it's intentional, then probably the plain CREATE should be allowed to do it too.

            _Either MinIO or credentials to AWS are needed to run S3 tests._
            _See suite/s3/suite.pm for how the suite initializes connection parameters, configure your MinIO or AWS accordingly, put the test case into suite/s3 and run from there._
            _Alternatively, all S3-related options can be provided from the command line._

            {code:sql}
            drop table if exists t, t2;

            create table t (a int) engine=Aria;
            insert into t values (1),(2);
            alter table t engine=S3;
            --error 1005
            create table t2 (a int) engine=S3;
            --error 1005
            create table t2 like t;
            create or replace table t2 like t;
            show create table t2;

            # Cleanup
            drop table if exists t, t2;
            {code}

            {code:sql|title=bb-10.11-midenok 8e82c973e}
            alter table t engine=S3;
            create table t2 (a int) engine=S3;
            ERROR HY000: Can't create table `test`.`t2` (errno: 131 "Command not supported by the engine")
            create table t2 like t;
            ERROR HY000: Can't create table `test`.`t2` (errno: 131 "Command not supported by the engine")
            create or replace table t2 like t;
            show create table t2;
            Table Create Table
            t2 CREATE TABLE `t2` (
              `a` int(11) DEFAULT NULL
            ) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
            {code}

            Before MDEV-25292, CREATE OR REPLACE would fail with ER_CANT_CREATE_TABLE/131, the same way as both CREATEs.
            elenst Elena Stepanova made changes -
            midenok Aleksey Midenkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]

            Please review bb-10.11-midenok

            midenok Aleksey Midenkov added a comment - Please review bb-10.11-midenok
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ] Oleksandr Byelkin [ sanja ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            sanja Oleksandr Byelkin made changes -
            Assignee Oleksandr Byelkin [ sanja ] Michael Widenius [ monty ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.12 [ 28320 ]
            Fix Version/s 10.11 [ 27614 ]
            midenok Aleksey Midenkov made changes -
            Fix Version/s N/A [ 14700 ]
            Fix Version/s 11.0 [ 28320 ]
            Assignee Michael Widenius [ monty ] Aleksey Midenkov [ midenok ]
            Resolution Fixed [ 1 ]
            Status In Review [ 10002 ] Closed [ 6 ]

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.