We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我发现在CREATE TABLE IF NOT EXIST xxx_table 这样的SQL执行会导致字段解析乱序;我分析到代码如果已经存在的表,执行这样的SQL会更新table cache schema,是不是这样原因导致的?
xxx_table
if (!isSeek && !isDml) { // 使用新的表结构元数据管理方式 EntryPosition position = createPosition(event.getHeader()); tableMetaCache.apply(position, event.getDbName(), queryString, null); } /* 传递参数position,是尝试根据dump到不同位点位置的binlog使用不同的table schema进行解析,这里的逻辑是没有实现吗? */ public boolean apply(EntryPosition position, String schema, String ddl, String extra) { tableMetas.clear(); synchronized (this) { if (StringUtils.isNotEmpty(schema)) { repository.setDefaultSchema(schema); } try { // druid暂时flush privileges语法解析有问题 if (!StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "flush") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "grant") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "revoke") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "create user") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "alter user") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "drop user") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "create database")) { repository.console(ddl); } } catch (Throwable e) { logger.warn("parse faield : " + ddl, e); } } // TableMeta meta = find("tddl5_00", "ab"); // if (meta != null) { // repository.setDefaultSchema("tddl5_00"); // System.out.println(repository.console("show create table tddl5_00.ab")); // System.out.println(repository.console("show columns from tddl5_00.ab")); // } return true; } public void setDefaultSchema(String name) { if (name == null) { this.defaultSchema = null; } else { String normalizedName = SQLUtils.normalize(name).toLowerCase(); Schema defaultSchema = (Schema)this.schemas.get(normalizedName); if (defaultSchema != null) { this.defaultSchema = defaultSchema; } else if (this.defaultSchema != null && this.defaultSchema.getName() == null) { this.defaultSchema.setName(name); this.schemas.put(normalizedName, this.defaultSchema); } else { defaultSchema = new Schema(this); defaultSchema.setName(name); this.schemas.put(normalizedName, defaultSchema); this.defaultSchema = defaultSchema; } } }
The text was updated successfully, but these errors were encountered:
@agapple
Sorry, something went wrong.
升级druid版本为1.2.6后已解决,会正确处理create table if not exist的合并语义
No branches or pull requests
[BUG]
我发现在CREATE TABLE IF NOT EXIST
xxx_table
这样的SQL执行会导致字段解析乱序;我分析到代码如果已经存在的表,执行这样的SQL会更新table cache schema,是不是这样原因导致的?The text was updated successfully, but these errors were encountered: