V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
s609926202
V2EX  ›  数据库

MariaDB 遇到个奇怪的现象,空表无缘无故消失、

  •  
  •   s609926202 · 2021-09-11 11:00:38 +08:00 · 1257 次点击
    这是一个创建于 929 天前的主题,其中的信息可能已经有所发展或是发生改变。

    例表:t_table,表中无数据。

    生产环境下( MySQL )这个表一切正常,我本地环境下( MariaDB 10.4.10-MariaDB-log )都出现好几次表无缘无故消失不见(只剩 .ibd 文件,.frm 文件消失了)。

    表结构如下:

    CREATE TABLE `t_table` (
      `id` char(36) NOT NULL,
      `assem_ref` varchar(20) NOT NULL,
      `as_id` char(36) NOT NULL,
      `goods_id` char(36) NOT NULL,
      `period` varchar(20) NOT NULL DEFAULT '',
      `in_date` date DEFAULT NULL,
      `in_pici` varchar(20) NOT NULL,
      `in_count` int(20) unsigned NOT NULL,
      `in_count_total` int(20) unsigned NOT NULL,
      `cost_price` decimal(18,2) NOT NULL DEFAULT '0.00',
      `cost_material` decimal(18,2) unsigned NOT NULL,
      `cost_labor` decimal(18,2) unsigned NOT NULL,
      `cost_prod` decimal(18,2) unsigned NOT NULL',
      `input_user_id` char(36) NOT NULL,
      `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
      `update_time` datetime DEFAULT NULL,
      `cost_fuli` decimal(18,2) NOT NULL DEFAULT '0.00',
      `cost_power` decimal(18,2) NOT NULL DEFAULT '0.00',
      `cost_low_value` decimal(18,2) NOT NULL DEFAULT '0.00',
      `cost_house` decimal(18,2) NOT NULL DEFAULT '0.00',
      `cost_depr` decimal(18,2) NOT NULL DEFAULT '0.00',
      `cost_leasing` decimal(18,2) NOT NULL,
      `cost_soft` decimal(18,2) NOT NULL DEFAULT '0.00',
      `cost_dev` decimal(18,2) NOT NULL DEFAULT '0.00',
      `cost_init_material` decimal(18,2) NOT NULL DEFAULT '0.00',
      PRIMARY KEY (`id`) USING BTREE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
    

    当用 drop table t_table 时,提示:Unknown table 't_table',但是在数据目录下还有 t_table.ibd 文件存在,对应的 .ifm 消失了。

    删除 t_table.ibd 文件后,重新建表时又提示:Table 't_table' already exists,t_table.ibd 文件自动恢复了、、

    大家有遇到这种情况吗?求解是什么导致的,因为只有这一张表隔三差五出现这个问题。

    5 条回复    2021-09-22 14:18:09 +08:00
    westoy
        1
    westoy  
       2021-09-11 11:04:09 +08:00
    你硬盘有可能要不行了
    singerll
        2
    singerll  
       2021-09-11 11:56:19 +08:00 via Android
    mysql 的系统表是有这个 bug,动不动看不到。
    s609926202
        3
    s609926202  
    OP
       2021-09-11 12:10:32 +08:00
    @westoy 只有这一张表有问题
    gBurnX
        4
    gBurnX  
       2021-09-12 02:48:02 +08:00
    1.OS ?

    2.OS version ?

    3.MariaDB version ?

    4.SELinux 关闭没?

    5.MariaDB 安装方式?

    6.MariaDB 安装时有没有指派特殊账号?

    7.MariaDB 数据目录的权限 对于 MariaDB 服务的进程的账号,有没有限制?

    8.有没有监控 MariaDB 所有的 SQL,从里面提取"DROP TABLE"关键字?

    9.有没有联合监控 SQL 与.frm 文件,在.frm 消失时,最近 10 秒内的 SQL ?

    如果还不行,万不得已就只能走非常麻烦的带源码调试了,这种方式的麻烦程度接近于反汇编,虽然一定能找到结果,但巨麻烦。
    lolizeppelin
        5
    lolizeppelin  
       2021-09-22 14:18:09 +08:00
    看 change log 中 bug 修复有没有相关的

    用官方稳定版. 10.4 的是 10.4.21
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3221 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 11:39 · PVG 19:39 · LAX 04:39 · JFK 07:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.