Comments (7)
明白, 还真有点难处理。我把 rewrite buffer 改到临时文件好了
from godis.
提供一种解决方法,如下:
from godis.
这个方案没有解决 aofRewriteBuffer <- cmd 会阻塞的问题。handleAof 被阻塞后,db.aofChan 很快也会填满,进而阻塞主协程的 addAof 函数, 最终导致所有写命令被阻塞,同时 goroutine 数量迅速上升。我觉得还是从源头上解决 aofRewriteBuffer 会被填满的问题比较好
from godis.
是的,上面的方案只是解决了死锁的问题。要解决aofRewriteBuffer阻塞的问题,还有个方法:
- 直接去掉aofRewriteBuffer,handleAof方法中,收到aofChan的数据后,获取锁,不再同步一份数据到aofRewriteBuffer。
- startRewrite方法中,已经获取到了aof 文件的filesize A,这个filesize在finishRewrite方法中可以用上。
- finishRewrite方法中,获取到锁之后,handleAof方法无法获取到锁,也就没办法继续往aof文件中写。finishRewrite方法此时再对aof文件sync落盘,此时从filesize A 到aof 文件尾,就是在重写aof文件过程中,处理的请求,直接将这些操作读出来写到临时文件,最后mv就行了
from godis.
好主意
from godis.
读取aof文件内容,加载内容到临时DB对象
如果当前数据库中有1G的数据,再加载一份AOF文件岂不是内存又多占用了1G?
from godis.
fixed in 48ba261
from godis.
Related Issues (20)
- support CONFIG command HOT 4
- Support Lua Script
- RewriteAof will panic if `appendonly` property is no
- Try to merge RegisterGodisCommand and RegisterCommand HOT 1
- 在阅读源码时遇到的一些问题 HOT 8
- 增加ARM版本支持 HOT 3
- support scan HOT 3
- dump rdb file failed Unknown string encode type HOT 3
- Optimize Logger 优化日志
- Raft Cluster Support Failover
- 键过期后,仍然存在Keys列表中 HOT 1
- datastruct/dict/concurrent.go Get and GetWithLock HOT 2
- godis服务接受一个客户端连接失败后,会发信号通知godis服务shutdown,似乎不太合理。 HOT 1
- 请问这个项目的初衷是? HOT 8
- why release lock reverse order in RWUnLocks HOT 1
- considere more redis-style IO model? HOT 4
- 不支持redis的那各key分组设置吗? HOT 2
- 有没有client api HOT 2
- support ziplist HOT 1
- georadius是错误的
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godis.