当前位置: 首页 > news >正文

关于 MySQL、PostgresSQL、Mariadb 数据库2038千年虫问题

MySQL

测试时间:2023-8

启动MySQL服务后,将系统时间调制2038年01月19日03时14分07秒之后的日期,发现MySQL服务自动停止。

根据最新的MySQL源码(mysql-8.1.0)分析,sql/sql_parse.cc中依然存在2038年千年虫问题

/*If the time has gone past end of epoch we need to shutdown the server. Butthere is possibility of getting invalid time value on some platforms.For example, gettimeofday() might return incorrect value on solarisplatform. Hence validating the current time with 5 iterations beforeinitiating the normal server shutdown process because of time gettingpast 2038.
*/
if (tries > max_tries) {/*If the time has got past epoch, we need to shut this server down.We do this by making sure every command is a shutdown and wehave enough privileges to shut the server downTODO: remove this when we have full 64 bit my_time_t support*/LogErr(ERROR_LEVEL, ER_UNSUPPORTED_DATE);const ulong master_access = thd->security_context()->master_access();thd->security_context()->set_master_access(master_access | SHUTDOWN_ACL);error = true;kill_mysql();}

TODO: remove this when we have full 64 bit my_time_t support:表示直到MySQL完成支持64位时间戳时才移除这个限制

PostgreSQL

测试时间:2023-8

测试版本:psql-10.1、psql-15.4

启动postgresql服务后,将系统时间调制2038年01月19日03时14分07秒之后的日期,psql-15.4版服务正常运行,数据库可以正常读写;但是重启服务postgresql失败(也就是说postgresql在2038年后无法正常启动)。psql-10.1服务直接挂掉,不能使用。

日志分析:

在这里插入图片描述
在这里插入图片描述

从日志上可以看出,调整时间后,重启postgresql,日志中的记录时间有问题;启动过程中一直报“D:/PostgresSQL/15/share/timezone”目录不存在,这个问题可能是postgresql获取时区出了问题(有可能是系统的问题)。

Mariadb

测试时间:2023-8

测试版本:10.8.8,11.1.2-GA(测试日期的最新版)

现象与PostgreSQL类似,调整时间后能正常读写,但是不能重启。(未分析日志)

从Mariadb的官网上,可以查到旧版计划(5.6版本)中就有用关于解决2038年千年虫问题的计划;好像未彻底实时(Mariadb不存在5.6版本)。

总结

距离下一次千年虫还有15年的时间,但愿MySQL能修复这个问题;不过按照Oracle的德性,不排除到了2038年停止MySQL社区版的维护,强制用户升级到企业版(大赚一笔)。

Mariadb、PostgreSQL 未来几年修复千年虫问题的可能性还是比较大的(毕竟已经修复了一部分),我们尽请期待吧。

http://www.lryc.cn/news/152096.html

相关文章:

  • Linux - Docker 安装使用 常用命令 教程
  • AtCoder Beginner Contest 318 G - Typical Path Problem 题解
  • 21.4 CSS 盒子模型
  • MybatisPlus入门
  • 飞腾平台芯片测试固件(SFW)和开机启动log
  • 【大数据实训】基于Hive的北京市天气系统分析报告(二)
  • WPF列表样式
  • Android逆向学习(二)vscode进行双开与图标修改
  • 一个基于YAPI接口生产代码的开源工具
  • Redis 缓存穿透击穿和雪崩
  • 在windows上配置ninja环境
  • ③matlab向量和矩阵
  • 一、了解[mysql]索引底层结构和算法
  • DockerFile常用命令
  • Android 动画之插值器PathInterpolator
  • 递归学习(转载)
  • python接口自动化(二)--什么是接口测试、为什么要做接口测试(详解)
  • HashMap源码阅读(一)
  • C语言:动态内存(一篇拿捏动态内存!)
  • Lua - 替换字符串中的特殊字符
  • 按钮控件之3---QRadioButton 单选按钮/单选框控件
  • 基于STM32设计的游戏姿态数据手套
  • react跳转页面redux数据被清除
  • Spring Cloud 微服务2
  • 侯捷课程笔记(一)(传统c++语法,类内容)
  • 自动化安装Nginx脚本:简化您的服务器配置
  • 通过es索引生命周期策略删除日志索引
  • 网络实验 VlAN 中 Trunk Access端口的说明及实验
  • 打包个七夕exe玩玩
  • ReactNative 井字游戏 实战