[MDEV-29767] CREATE OR REPLACE bypasses S3 restriction for table creation Created: 2022-10-11  Updated: 2023-05-18  Resolved: 2023-01-26

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Create Table, Storage Engine - S3
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-25292 Atomic CREATE OR REPLACE TABLE Stalled
Relates

 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.



 Comments   
Comment by Aleksey Midenkov [ 2022-10-17 ]

Please review bb-10.11-midenok

Generated at Thu Feb 08 10:11:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.