首页 > 数据库 >MySQL Replication--Failed to flush master info 问题

MySQL Replication--Failed to flush master info 问题

时间:2023-04-07 19:46:28浏览次数:33  
标签:info log -- mi will Failed master flush

问题描述

MySQL复制不定期出现问题,报错为:Failed to flush master info,但具体原因尚未定位到。

涉及代码

查看MySQL 5.7.34版本的代码:

int flush_master_info(Master_info* mi, bool force)
{
  DBUG_ENTER("flush_master_info");
  assert(mi != NULL && mi->rli != NULL);
  /*
    The previous implementation was not acquiring locks.
    We do the same here. However, this is quite strange.
  */
  /*
    With the appropriate recovery process, we will not need to flush
    the content of the current log.

    For now, we flush the relay log BEFORE the master.info file, because
    if we crash, we will get a duplicate event in the relay log at restart.
    If we change the order, there might be missing events.

    If we don't do this and the slave server dies when the relay log has
    some parts (its last kilobytes) in memory only, with, say, from master's
    position 100 to 150 in memory only (not on disk), and with position 150
    in master.info, there will be missing information. When the slave restarts,
    the I/O thread will fetch binlogs from 150, so in the relay log we will
    have "[0, 100] U [150, infinity[" and nobody will notice it, so the SQL
    thread will jump from 100 to 150, and replication will silently break.
  */
  mysql_mutex_t *log_lock= mi->rli->relay_log.get_log_lock();

  mysql_mutex_lock(log_lock);

  int err=  (mi->rli->flush_current_log() ||
             mi->flush_info(force));

  mysql_mutex_unlock(log_lock);

  DBUG_RETURN (err);
}

在执行时抛出异常:

//============================================//
if (flush_master_info(mi, FALSE))
{
	mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
			   ER(ER_SLAVE_FATAL_ERROR),
			   "Failed to flush master info.");
	mysql_mutex_unlock(&mi->data_lock);
	goto err;
}
//============================================//
if (flush_master_info(mi, force_flush_mi_info))
{
	error= 1;
	sql_print_error("Failed to flush master info file.");
}

解决办法

重启复制即可修复。

标签:info,log,--,mi,will,Failed,master,flush
From: https://www.cnblogs.com/gaogao67/p/17297166.html

相关文章

  • day21| 530+501+236
    530.二叉搜索树的最小绝对差 题目简述:给你一个二叉搜索树的根节点 root ,返回 树中任意两不同节点值之间的最小差值 。差值是一个正数,其数值等于两值之差的绝对值。 思路:1.二叉搜索树的中序遍历是单调的2.可以证明,求这单调数组中的最小绝对差,拿出来比较的两个数一......
  • JAVA - 面向对象编程
    面向对象是在之前基本实现的基础上的又一抽象,这里的“高内聚,低耦合”体现的更加明显,有抽丝剥茧、不断总结的感觉了。学习的时候真的会有拨开云雾见月明的感觉,这种感觉真的会上瘾。你慢慢发现所有的东西都在以自己的规律运转,发现验证使用,真的很有《实践论》的味道。我能做些......
  • acwing2816. 判断子序列
    linkcode#include<bits/stdc++.h>usingnamespacestd;constintN=100010;inta[N],b[N];intmain(){ intn,m; cin>>n>>m; for(inti=1;i<=n;i++)cin>>a[i]; for(inti=1;i<=m;i++)cin>>b[i]; in......
  • windows使用openssh
    1openssh安装openSSH下载路径(Windowsx64版本)win10自带了openssh工具,可在设置-->应用-->管理可选功能-->添加功能内查看1.解压到需要部署的服务器的C:\ProgramFiles下。别问为什么,官方就这么说的2.使用管理员模式的cmd到C:\ProgramFiles\OpenSSH-Win64路径下安装sshd......
  • 1210. 穿过迷宫的最少移动次数
    题目链接:1210.穿过迷宫的最少移动次数参考:还在if-else?一个循环处理六种移动!代码classSolution{private:staticconstexprintmov[3][3]={{1,0,0},{0,1,0},{0,0,1}};//下、右、旋转public:intminimumMoves(vector<vector<int>>&grid){......
  • VScode美化
    RESULT:EVA-初号机配色主题效果1.需要的东西vscodebackground插件customCSSandJSloader插件一些png素材,推荐网址:https://www.vhv.rs/https://anime-pictures.net/EVAUnit-1ThemeV2主题插件2.安装步骤安装vscode安装插件和主题下载好相应的png......
  • flask5
    今日内容1信号#Flask框架中的信号基于blinker(安装这个模块),其主要就是让开发者可是在flask请求过程中定制一些用户行为flask和django都有#观察者模式,又叫发布-订阅(Publish/Subscribe)23种设计模式之一pip3.8installblinker#信号:signial翻译过来的,并发编程中学过......
  • .Net6注入Consul服务
    .Net6注入Consul服务直接上代码了(参考了一下其他博客进行总结一下),我这边项目工程是模拟微服务模式,新建类库把服务打包成了nuget方便调用现在先大致介绍一下,结尾放demo案例代码consul心跳心跳的地址要于下面配置文件的地址一样这里先定义一会配置文件也要相同///<summary>......
  • RMAN删除过期备份或非过期备份
    (一)删除备份--DELETE命令用于删除RMAN备份记录及相应的物理文件。当使用RMAN执行备份操作时,会在RMAN资料库(RMANRepository)中生成RMAN备份记录,默认情况下RMAN备份记录会被存放在目标数据库的控制文件中,如果配置了恢复目录(RecoveryCatalog),那么该备份记录也会被存放到恢复目录中。R......
  • FastCFS:FastVote-server的作用、使用的时机
     第一:fastvote-server仅仅是个简单的投票辅助服务器,所谓的投票客户端功能原生集成在fastdir、faststore服务器组件中第二:fastdir、faststore当且仅当 其群集中的servers个数为【偶数】(even)时,才去使用fastvote-server的辅助投票功能第三:当fastdir、faststore的配置中,servers......