Comments (7)
@ranzhendong hi,你能把你写的代码发出来看下吗?什么版本的NutsDB也说下
from nutsdb.
版本
nutsdb v0.5.0
场景
通过gorountine做周期性key插入动作。
func connect() (db *nutsdb.DB) {
var (
err error
c datastruck.Config
)
if err = c.Config(); err != nil {
log.Println(MyERR.ErrorLog(12012), fmt.Sprintf("%v", err))
return nil,err
}
opt := nutsdb.DefaultOptions
opt.Dir = c.NutsDB.Path
if db, err = nutsdb.Open(opt); err != nil {
log.Println(err)
return nil,err
}
return db,nil
}
func Put(bct string, key, val interface{}) error {
var (
keyByte, valByte []byte
err error
db *nutsdb.DB
)
if db, err = connect(); err != nil {
return err
}
defer func() {
_ = db.Close()
}()
err = db.Update(
func(tx *nutsdb.Tx) error {
//judge key type
switch key.(type) {
case string:
keyByte = []byte(key.(string))
case int:
keyByte, _ = IntToBytes(val.(int), 3)
case []uint8:
keyByte = key.([]byte)
}
switch val.(type) {
case string:
valByte = []byte(val.(string))
case int:
valByte, _ = IntToBytes(val.(int), 3)
case []uint8:
valByte = val.([]byte)
}
if err = tx.Put(bct, keyByte, valByte, 0); err != nil {
return err
}
return nil
})
if err != nil {
log.Println("NutsDB PUT ERR",err)
return err
}
return nil
}
其他库去调用PUT函数去插入的值的时候,在频率比较高的时候就会出错,大概8-10/s次的写入速率。
现象
db.buildIndexes error: when build activeDataIndex readAt err: crc error
from nutsdb.
@ranzhendong , hi ,你写的代码有问题,db连一次就好了,不用每次put的时候连一次。
from nutsdb.
@ranzhendong , hi ,你写的代码有问题,db连一次就好了,不用每次put的时候连一次。
我在每次put之后,将获取的连接对象关闭了,这样的写法是有问题的吧?
defer func() {
_ = db.Close()
}()
徐老师,你的意思是刚开始创建连接,获取连接对象,来进行反复读写操作。而不是每一次读写操作就执行一次完整的创建连接关闭连接过程是吧?
from nutsdb.
from nutsdb.
您好,同发现此问题( nutsdb v0.5.0,go1.16),出现这个错误后,本地数据貌似就不能用了,读写都提示 db.buildIndexes error,如何修复呢?
from nutsdb.
您好,同发现此问题( nutsdb v0.5.0,go1.16),出现这个错误后,本地数据貌似就不能用了,读写都提示 db.buildIndexes error,如何修复呢?
你好,这个issue 已经关闭,有问题你重新提issue,因为关闭的,一般close的issue,我不会再看了。
from nutsdb.
Related Issues (20)
- [BUG] error concurrent map writes HOT 8
- 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 没有在重新打开数据库的时候正确恢复状态
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.