Skip to content
New issue

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

ClearTableFieldsAll cannot clear the cache #2552

Closed
zfha opened this issue Mar 29, 2023 · 1 comment
Closed

ClearTableFieldsAll cannot clear the cache #2552

zfha opened this issue Mar 29, 2023 · 1 comment
Labels
bug It is confirmed a bug, but don't worry, we'll handle it. done This issue is done, which may be release in next version.

Comments

@zfha
Copy link

zfha commented Mar 29, 2023

1. What version of Go and system type/arch are you using?

go1.18

2. What version of GoFrame are you using?

goframe v2.2.0

3. Can this issue be re-produced with the latest release?

yes

重现步骤:

  1. 本地表删除了这个字段,使用gen dao自动生成,调试通过
  2. 部署到现网,现网正常运行
  3. 删除现网表的字段,现网会报错
  4. 重新再部署一次,现网回复正常

总结:感觉是goframe请求过一次表,表的字段会被缓存,之后删除数据库中的表字段,再次查询会使用缓存中的表字段去查询,导致报错。

尝试解决方案1:无果

调用ClearTableFieldsAll 清除字段缓存,但是清除之后仍然不会自动调用 SHOW FULL COLUMNS FROM xxx

debug 发现如图
wecom-temp-2e76a37028ef61d642225d4a88387f46

TableFields 和 default 中间多了个@导致无法匹配。

尝试解决方案2:无果

调用ClearTableFields主动传递 table 的名称,结果tableFieldsMap确实被清理,但是再次调用sql,仍然没有执行 SHOW FULL COLUMNS FROM xxx,仍然会获取到被删除的字段

@gqcn gqcn changed the title ClearTableFieldsAll 无法真正的清除字段缓存 ClearTableFieldsAll cannot clear the cache Apr 12, 2023
@gqcn gqcn added the bug It is confirmed a bug, but don't worry, we'll handle it. label Aug 21, 2023
gqcn added a commit that referenced this issue Feb 4, 2024
@gqcn
Copy link
Member

gqcn commented Feb 4, 2024

#3300

@gqcn gqcn closed this as completed Feb 4, 2024
@gqcn gqcn added the done This issue is done, which may be release in next version. label Feb 4, 2024
gqcn added a commit that referenced this issue Feb 4, 2024
gqcn added a commit that referenced this issue Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It is confirmed a bug, but don't worry, we'll handle it. done This issue is done, which may be release in next version.
Projects
None yet
Development

No branches or pull requests

2 participants