happyfish100 / fastdfs

FastDFS is an open source high performance distributed file system (DFS). It's major functions include: file storing, file syncing and file accessing, and design for high capacity and load balance. Wechat/Weixin public account (Chinese Language): fastdfs
GNU General Public License v3.0
8.99k stars 1.98k forks source link

Bug Report: storage_sync.c函数storage_binlog_write_ex错误处理问题 #532

Closed giantpoplar closed 1 year ago

giantpoplar commented 2 years ago

在storage_binlog_write_ex中:

...... if ((result=pthread_mutex_lock(&sync_thread_lock)) != 0) { logError("file: "FILE", line: %d, " \ "call pthread_mutex_lock fail, " \ "errno: %d, error info: %s", \ LINE, result, STRERROR(result)); } ......

这里lock出错后,依然继续往下处理,这个是有点问题的吧?我们在做高并发删除的时候,fastdfs生成了下面的binlog,有1行文件名为空,然后sync线程scan到这一行也进行不下去了

...... 1632325133 D M05/7D/61/CgI4e1x2DRaAW2p9AAABkZO6WB0987.xml 1632325133 D M04/4D/09/CgI4e1u02YSAI9zfAAABkbzo4K8546.xml 1632325133 D 1632325133 D M03/59/C6/CgI4e1u1kIaAUfFWAAAfZyKjO1M782.xml 1632325133 D M0A/F8/65/CgI4el2vLk6AcgNDAAAWLPouIAM000.xml ......

happyfish100 commented 2 years ago

删除掉有问题的binlog内容即可

happyfish100 commented 2 years ago

很奇怪为啥会出现不完整的binlog记录。麻烦告知使用的 FastDFS版本

giantpoplar commented 2 years ago

5.07。场景是我们在测试环境大量删除过期的文件索引,删除时会调用一下FDFS的文件Delete接口,但由于已经做过磁盘清理了(没有通过接口),所以大量删除都是不存在的文件。除了出现上述问题,进程运行了一会儿会大量报errno: 9,bad file descriptor,然后会异常退出。我发现这种情况下删除的速度也不快。

happyfish100 commented 2 years ago

建议升级到最新的 V6.07