Comments (3)
@xww ,谢谢关注。你好,
1 关于你说的 func (tx *Tx) Commit() error {}
这边的数据在持久化到磁盘前,肯定是做了数据结构区分的,不然怎么做索引。
2 关于你说的 同时tx.buildIdxes(writesLen)又会把数据全部写在内存的list链表里面一次
这个是根据不同的数据结构建立对应的索引,不你说的会把数据全部写在内存的list链表里面一次
。
另外 nutsdb 的确还存在很多不足 ,欢迎指出,一起讨论,改善。
from nutsdb.
但是你看下面的代码,你为list类型的数据创建索引,确实是吧key和value都在内存中保存了一份啊?这个我没有理解错吧?也就是说磁盘有一份,内存的索引其实还有一份,这个索引并不是key+value的地址,而是直接就是key+value,对吧?
func (tx *Tx) buildListIdx(bucket string, entry *Entry) {
if _, ok := tx.db.ListIdx[bucket]; !ok {
tx.db.ListIdx[bucket] = list.New()
}
key, value := entry.Key, entry.Value
switch entry.Meta.Flag {
case DataLPushFlag:
_, _ = tx.db.ListIdx[bucket].LPush(string(key), value)
from nutsdb.
是的。对于list类型的确是内存和磁盘都存了一份。
from nutsdb.
Related Issues (20)
- The tx.IterateBuckets method only iterated through the buckets once. HOT 4
- Get All example doesn't work HOT 2
- bug: can't insert multiple values at list HOT 1
- There may be something wrong with the `mmap` implementation
- Suggestions for commercialisation of the project(项目商业化建议)
- Proposal for documents project of NutsDB which based Docusaurus HOT 7
- Implement `Watch` API
- pref: Optimize the memory usage of SortedSet HOT 5
- 关于 10000 个 websocket 处理数据使用 nutsdb 缓存状态
- 服务器在数据读写过程中异常断电,是否有概率出现crc error? HOT 5
- The GetAll function only return values not contians keys HOT 2
- Storing values larger than 2 GB
- 在window下 Merge报错 HOT 3
- pref: pre-computed to reduce the overhead of computing the crc of the flags of entry. HOT 4
- nil pointer dereference panic HOT 4
- Possible memory leak when opening a new DB by the commit buffer
- Goroutine leak in when closing a DB
- 迁移数据到 1.0
- IDGenerator 没有在重新打开数据库的时候正确恢复状态
- always get a lock error for backup
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 nutsdb.