mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
merge from github
This commit is contained in:
@@ -885,9 +885,9 @@ public class QueryLogEvent extends LogEvent {
|
|||||||
return "Q_DEFAULT_TABLE_ENCRYPTION";
|
return "Q_DEFAULT_TABLE_ENCRYPTION";
|
||||||
case Q_OPT_FLASHBACK_AREA:
|
case Q_OPT_FLASHBACK_AREA:
|
||||||
// or Q_DDL_SKIP_REWRITE
|
// or Q_DDL_SKIP_REWRITE
|
||||||
return "Q_DDL_SKIP_REWRITE";
|
return "Q_OPT_FLASHBACK_AREA";
|
||||||
case Q_OPT_INDEX_FORMAT_GPP_ENABLED:
|
case Q_OPT_INDEX_FORMAT_GPP_ENABLED:
|
||||||
return "Q_DDL_SKIP_REWRITE";
|
return "Q_OPT_INDEX_FORMAT_GPP_ENABLED";
|
||||||
case Q_HRNOW:
|
case Q_HRNOW:
|
||||||
// or Q_WSREP_SKIP_READONLY_CHECKS
|
// or Q_WSREP_SKIP_READONLY_CHECKS
|
||||||
return "Q_HRNOW";
|
return "Q_HRNOW";
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ public class MysqlConnector {
|
|||||||
byte[] scramble = authData;
|
byte[] scramble = authData;
|
||||||
try {
|
try {
|
||||||
encryptedPassword = MySQLPasswordEncrypter.scrambleCachingSha2(getPassword().getBytes(),
|
encryptedPassword = MySQLPasswordEncrypter.scrambleCachingSha2(getPassword().getBytes(),
|
||||||
scramble);
|
scramble);
|
||||||
} catch (DigestException e) {
|
} catch (DigestException e) {
|
||||||
throw new RuntimeException("can't encrypt password that will be sent to MySQL server.", e);
|
throw new RuntimeException("can't encrypt password that will be sent to MySQL server.", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ public class FastsqlSchemaTest {
|
|||||||
String sql1 = "CREATE TABLE `table_x1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, "
|
String sql1 = "CREATE TABLE `table_x1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, "
|
||||||
+ "`key1` longtext NOT NULL COMMENT 'key1', `value1` longtext NOT NULL COMMENT 'value1', PRIMARY KEY (`id`) )"
|
+ "`key1` longtext NOT NULL COMMENT 'key1', `value1` longtext NOT NULL COMMENT 'value1', PRIMARY KEY (`id`) )"
|
||||||
+ "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
|
+ "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
|
||||||
|
String sql2 = " CREATE TABLE IF NOT EXISTS `table_x1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT,"
|
||||||
|
+ "`key1` longtext NOT NULL COMMENT 'key1',PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
|
||||||
repository.console(sql1);
|
repository.console(sql1);
|
||||||
|
repository.console(sql2);
|
||||||
repository.setDefaultSchema("test");
|
repository.setDefaultSchema("test");
|
||||||
SchemaObject table = repository.findTable("table_x1");
|
SchemaObject table = repository.findTable("table_x1");
|
||||||
System.out.println(table.getStatement().toString());
|
System.out.println(table.getStatement().toString());
|
||||||
@@ -45,7 +48,7 @@ public class FastsqlSchemaTest {
|
|||||||
SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
|
SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
|
||||||
String sql = " CREATE TABLE `articles` ( `article_id` bigint NOT NULL AUTO_INCREMENT,"
|
String sql = " CREATE TABLE `articles` ( `article_id` bigint NOT NULL AUTO_INCREMENT,"
|
||||||
+ " `tags` json DEFAULT NULL, PRIMARY KEY (`article_id`),"
|
+ " `tags` json DEFAULT NULL, PRIMARY KEY (`article_id`),"
|
||||||
+ " KEY `articles_tags` ((cast(json_extract(`tags`,_utf8mb4'$[*]') as char(40))))"
|
+ " KEY `articles_tags` ((cast(json_extract(`tags`,_utf8mb4'$[*]') as char(40) array)))"
|
||||||
+ ") ENGINE=InnoDB AUTO_INCREMENT=1054 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
|
+ ") ENGINE=InnoDB AUTO_INCREMENT=1054 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
|
||||||
repository.console(sql);
|
repository.console(sql);
|
||||||
repository.setDefaultSchema("test");
|
repository.setDefaultSchema("test");
|
||||||
@@ -59,7 +62,7 @@ public class FastsqlSchemaTest {
|
|||||||
SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
|
SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
|
||||||
String sql = " CREATE TABLE `proposal_order_info` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,"
|
String sql = " CREATE TABLE `proposal_order_info` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,"
|
||||||
+ "`created_at` timestamp NULL DEFAULT NULL, " + "PRIMARY KEY (`id`) , "
|
+ "`created_at` timestamp NULL DEFAULT NULL, " + "PRIMARY KEY (`id`) , "
|
||||||
+ "KEY `idx_create_time` (`created_at`)"
|
+ "KEY `idx_create_time` (`created_at`) /*!80000 INVISIBLE */"
|
||||||
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 BLOCK_FORMAT=ENCRYPTED";
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 BLOCK_FORMAT=ENCRYPTED";
|
||||||
repository.console(sql);
|
repository.console(sql);
|
||||||
repository.setDefaultSchema("test");
|
repository.setDefaultSchema("test");
|
||||||
@@ -73,7 +76,7 @@ public class FastsqlSchemaTest {
|
|||||||
SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
|
SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
|
||||||
String sql = " create table example_vc_tbl( c1 int not null auto_increment primary key,"
|
String sql = " create table example_vc_tbl( c1 int not null auto_increment primary key,"
|
||||||
+ "c2 varchar(70), vc1 int as (length(c2)) virtual,"
|
+ "c2 varchar(70), vc1 int as (length(c2)) virtual,"
|
||||||
+ "DIM_SUM varchar(128) AS (MD5(UPPER(CONCAT(c2, c1)))) STORED)";
|
+ "DIM_SUM varchar(128) AS (MD5(UPPER(CONCAT(c2, c1)))) PERSISTENT)";
|
||||||
repository.console(sql);
|
repository.console(sql);
|
||||||
repository.setDefaultSchema("test");
|
repository.setDefaultSchema("test");
|
||||||
SchemaObject table = repository.findTable("example_vc_tbl");
|
SchemaObject table = repository.findTable("example_vc_tbl");
|
||||||
@@ -114,7 +117,7 @@ public class FastsqlSchemaTest {
|
|||||||
+ " name varchar(32) \n" + " )\n" + " partition by range(id) (\n"
|
+ " name varchar(32) \n" + " )\n" + " partition by range(id) (\n"
|
||||||
+ " partition p1 values less than (10),\n" + " partition px values less than MAXVALUE\n"
|
+ " partition p1 values less than (10),\n" + " partition px values less than MAXVALUE\n"
|
||||||
+ " );";
|
+ " );";
|
||||||
String sql2 = "alter table test add partition ( partition p2 VALUES LESS THAN (738552) ENGINE = InnoDB, PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB)";
|
String sql2 = "alter table test add partition ( partition 2 VALUES LESS THAN (738552) ENGINE = InnoDB, PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB)";
|
||||||
repository.console(sql1);
|
repository.console(sql1);
|
||||||
repository.console(sql2);
|
repository.console(sql2);
|
||||||
repository.setDefaultSchema("test");
|
repository.setDefaultSchema("test");
|
||||||
@@ -133,7 +136,7 @@ public class FastsqlSchemaTest {
|
|||||||
+ "avg_frequency decimal(12,4) DEFAULT NULL,\n" + "hist_size tinyint(3) unsigned DEFAULT NULL,\n"
|
+ "avg_frequency decimal(12,4) DEFAULT NULL,\n" + "hist_size tinyint(3) unsigned DEFAULT NULL,\n"
|
||||||
+ "hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') COLLATE utf8_bin DEFAULT NULL,\n"
|
+ "hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') COLLATE utf8_bin DEFAULT NULL,\n"
|
||||||
+ "histogram varbinary(255) DEFAULT NULL,\n" + "PRIMARY KEY (db_name,table_name,column_name)\n"
|
+ "histogram varbinary(255) DEFAULT NULL,\n" + "PRIMARY KEY (db_name,table_name,column_name)\n"
|
||||||
+ ") ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin";
|
+ ") ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0";
|
||||||
repository.console(sql1);
|
repository.console(sql1);
|
||||||
repository.setDefaultSchema("test");
|
repository.setDefaultSchema("test");
|
||||||
SchemaObject table = repository.findTable("test");
|
SchemaObject table = repository.findTable("test");
|
||||||
@@ -336,4 +339,5 @@ public class FastsqlSchemaTest {
|
|||||||
SchemaObject table = repository.findTable("test1");
|
SchemaObject table = repository.findTable("test1");
|
||||||
Assert.assertTrue(table != null);
|
Assert.assertTrue(table != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user