[MCOL-3876] CLONE - create or replace table engine=columnstore select * from breaks HTAP replication Created: 2020-03-10  Updated: 2020-03-13  Resolved: 2020-03-11

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr
Affects Version/s: None
Fix Version/s: Icebox

Type: Bug Priority: Major
Reporter: Zdravelina Sokolovska (Inactive) Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: HTAP
Environment:

GKE

mariadb/operator:0.4.0.skysql-dev-DBAAS-2605-6697dc
mariadb/management-enterprise:0.4.0.skysql-dev-DBAAS-2605-bf20da
mariadb/skysql-columnstore:1.4.3-1-SKIP-OAM



 Description   

create or replace table target_db.test engine=columnstore select * from source_db.test breaks HTAP replication

-------------------------------------------------------------------------------------------------------------------------
the problem is that the statements is not working with 'REPLACE' when columnstore table already exists
the Error above is breaking htap replication

MariaDB [(none)]> create or replace table target_db.test engine=columnstore select * from source_db.test ;
Query OK, 0 rows affected (0.262 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
MariaDB [(none)]>  create or replace table target_db.test engine=columnstore select * from source_db.test ;
ERROR 1178 (42000): The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types.

---------------------------------------------------------------------------------------------------------------------------

MariaDB [(none)]> select set_htap_replication('test', 'source_db', 'target_db');
+--------------------------------------------------------+
| set_htap_replication('test', 'source_db', 'target_db') |
+--------------------------------------------------------+
| Success.                                               |
+--------------------------------------------------------+
1 row in set (0.021 sec)

MariaDB [(none)]>  create database source_db ;
Query OK, 1 row affected (0.003 sec)
 
MariaDB [(none)]>  create database target_db ;
Query OK, 1 row affected (0.004 sec)
 
MariaDB [(none)]> create table source_db.test ( a int , b varchar(255) ) ;
Query OK, 0 rows affected (0.017 sec)
 
MariaDB [(none)]> show tables from target_db ;
+---------------------+
| Tables_in_target_db |
+---------------------+
| test                |
+---------------------+
1 row in set (0.000 sec)
 
MariaDB [(none)]> show create table target_db ;
ERROR 1046 (3D000): No database selected
MariaDB [(none)]> show create table target_db.test ;
+-------+------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                           |
+-------+------------------------------------------------------------------------------------------------------------------------+
| test  | CREATE TABLE `test` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)

MariaDB [(none)]> create or replace table target_db.test engine=columnstore select * from source_db.test ;
Query OK, 0 rows affected (0.262 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
MariaDB [(none)]>  create or replace table target_db.test engine=columnstore select * from source_db.test ;
ERROR 1178 (42000): The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types.

MariaDB [(none)]> insert into source_db.test values (1,'aaaaa') , (2,'bbbbb') , (3, 'cccccc') ;
Query OK, 3 rows affected (0.005 sec)
Records: 3  Duplicates: 0  Warnings: 0

MariaDB [(none)]> select * from  target_db.test ;
Empty set (0.068 sec)
 
MariaDB [(none)]> select * from  source_db.test ;
+------+--------+
| a    | b      |
+------+--------+
|    1 | aaaaa  |
|    2 | bbbbb  |
|    3 | cccccc |
+------+--------+
3 rows in set (0.000 sec)

MariaDB [(none)]> show slave status \G
*************************** 1. row ***************************
                Slave_IO_State: Waiting for master to send event
                   Master_Host: htap-jens-mariadb-maxscale-replication
                   Master_User: skysql_replication
                   Master_Port: 3309
                 Connect_Retry: 60
               Master_Log_File: mysql-bin.000001
           Read_Master_Log_Pos: 3776
                Relay_Log_File: htap-jens-mdb-cs-single-0-relay-bin.000002
                 Relay_Log_Pos: 1477
         Relay_Master_Log_File: mysql-bin.000001
              Slave_IO_Running: Yes
             Slave_SQL_Running: No
               Replicate_Do_DB:
           Replicate_Ignore_DB:
            Replicate_Do_Table:
        Replicate_Ignore_Table:
       Replicate_Wild_Do_Table:
   Replicate_Wild_Ignore_Table:
                    Last_Errno: 1093
                    Last_Error: Error 'Table 'test' is specified twice, both as a target for 'CREATE' and as a separate source for data' on query. Default database: ''. Query: 'create or replace table target_db.test engine=columnstore select * from target_db.test'
                  Skip_Counter: 0
           Exec_Master_Log_Pos: 3374
               Relay_Log_Space: 2208
               Until_Condition: None
                Until_Log_File:
                 Until_Log_Pos: 0
            Master_SSL_Allowed: No
            Master_SSL_CA_File:
            Master_SSL_CA_Path:
               Master_SSL_Cert:
             Master_SSL_Cipher:
                Master_SSL_Key:
         Seconds_Behind_Master: NULL
 Master_SSL_Verify_Server_Cert: No
                 Last_IO_Errno: 0
                 Last_IO_Error:
                Last_SQL_Errno: 1093
                Last_SQL_Error: Error 'Table 'test' is specified twice, both as a target for 'CREATE' and as a separate source for data' on query. Default database: ''. Query: 'create or replace table target_db.test engine=columnstore select * from target_db.test'
   Replicate_Ignore_Server_Ids:
              Master_Server_Id: 1
                Master_SSL_Crl:
            Master_SSL_Crlpath:
                    Using_Gtid: Slave_Pos
                   Gtid_IO_Pos: 1-1-21
       Replicate_Do_Domain_Ids:
   Replicate_Ignore_Domain_Ids:
                 Parallel_Mode: conservative
                     SQL_Delay: 0
           SQL_Remaining_Delay: NULL
       Slave_SQL_Running_State:
              Slave_DDL_Groups: 35
Slave_Non_Transactional_Groups: 0
    Slave_Transactional_Groups: 2
1 row in set (0.000 sec)



 Comments   
Comment by Zdravelina Sokolovska (Inactive) [ 2020-03-12 ]

that's the Bug , Please see below :

MariaDB [(none)]> create database foo ;
Query OK, 1 row affected (0.004 sec)

Replace is working with innodb engine if table already exists :

MariaDB [(none)]> create table a (a int ) ;
ERROR 1046 (3D000): No database selected
MariaDB [(none)]> create table foo.rr (a int ) ;
Query OK, 0 rows affected (0.019 sec)
 
 
MariaDB [(none)]> create or replace table foo.b select * from  foo.rr ;
Query OK, 0 rows affected (0.017 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
MariaDB [(none)]> create or replace table foo.b select * from  foo.rr ;
Query OK, 0 rows affected (0.025 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
MariaDB [(none)]> create or replace table foo.b select * from  foo.rr ;
Query OK, 0 rows affected (0.024 sec)
Records: 0  Duplicates: 0  Warnings: 0

Replace is not working with columnstore engine if table already exists :

MariaDB [(none)]> create or replace table foo.c engine=columnstore select * from  foo.rr ;
Query OK, 0 rows affected (0.252 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
MariaDB [(none)]> create or replace table foo.c engine=columnstore select * from  foo.rr ;
ERROR 1178 (42000): The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types.
MariaDB [(none)]>

Generated at Thu Feb 08 02:46:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.