From 270c1ade1e12bc92196a8490499c70b0bf54f3d6 Mon Sep 17 00:00:00 2001 From: presbrey Date: Fri, 31 Oct 2014 07:29:45 -0400 Subject: [PATCH 1/3] Update config.toml minor typo --- config/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.toml b/config/config.toml index 6b6722b..f75c784 100644 --- a/config/config.toml +++ b/config/config.toml @@ -50,7 +50,7 @@ conn_write_buffer_size = 10240 # if connection receives no data after n seconds, it may be dead, close # 0 to disable and not check -conn_keepavlie_interval = 0 +conn_keepalive_interval = 0 # checking TTL (time to live) data every n seconds # if you set big, the expired data may not be deleted immediately From 0009fe83b9f09d6f91593a539b6bb956d836050c Mon Sep 17 00:00:00 2001 From: siddontang Date: Fri, 31 Oct 2014 20:33:13 +0800 Subject: [PATCH 2/3] add put and delete info back --- server/info.go | 30 ++++++++++++++++-------------- store/writebatch.go | 14 +++++++++++++- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/server/info.go b/server/info.go index 1b7d27d..0e807c1 100644 --- a/server/info.go +++ b/server/info.go @@ -173,31 +173,33 @@ func (i *info) dumpStore(buf *bytes.Buffer) { s := i.app.ldb.StoreStat() - getNum := s.GetNum.Get() - getTotalTime := s.GetTotalTime.Get() + // getNum := s.GetNum.Get() + // getTotalTime := s.GetTotalTime.Get() - gt := int64(0) - if getNum > 0 { - gt = getTotalTime.Nanoseconds() / (getNum * 1e3) - } + // gt := int64(0) + // if getNum > 0 { + // gt = getTotalTime.Nanoseconds() / (getNum * 1e3) + // } - commitNum := s.BatchCommitNum.Get() - commitTotalTime := s.BatchCommitTotalTime.Get() + // commitNum := s.BatchCommitNum.Get() + // commitTotalTime := s.BatchCommitTotalTime.Get() - ct := int64(0) - if commitNum > 0 { - ct = commitTotalTime.Nanoseconds() / (commitNum * 1e3) - } + // ct := int64(0) + // if commitNum > 0 { + // ct = commitTotalTime.Nanoseconds() / (commitNum * 1e3) + // } i.dumpPairs(buf, infoPair{"name", i.app.cfg.DBName}, infoPair{"get", s.GetNum}, infoPair{"get_missing", s.GetMissingNum}, - infoPair{"get_per_time", fmt.Sprintf("%0.002fms", float64(gt)/1000.0)}, + infoPair{"put", s.PutNum}, + infoPair{"delete", s.DeleteNum}, + infoPair{"get_total_time", s.GetTotalTime.Get().String()}, infoPair{"iter", s.IterNum}, infoPair{"iter_seek", s.IterSeekNum}, infoPair{"iter_close", s.IterCloseNum}, infoPair{"batch_commit", s.BatchCommitNum}, - infoPair{"batch_commit_per_time", fmt.Sprintf("%0.002fms", float64(ct)/1000.0)}, + infoPair{"batch_commit_total_time", s.BatchCommitTotalTime.Get().String()}, ) } diff --git a/store/writebatch.go b/store/writebatch.go index 773eeaf..a7fd84a 100644 --- a/store/writebatch.go +++ b/store/writebatch.go @@ -9,19 +9,28 @@ type WriteBatch struct { wb driver.IWriteBatch st *Stat - db *DB + putNum int64 + deleteNum int64 + db *DB } func (wb *WriteBatch) Put(key []byte, value []byte) { + wb.putNum++ wb.wb.Put(key, value) } func (wb *WriteBatch) Delete(key []byte) { + wb.deleteNum++ wb.wb.Delete(key) } func (wb *WriteBatch) Commit() error { wb.st.BatchCommitNum.Add(1) + wb.st.PutNum.Add(wb.putNum) + wb.st.DeleteNum.Add(wb.deleteNum) + wb.putNum = 0 + wb.deleteNum = 0 + var err error t := time.Now() if wb.db == nil || !wb.db.needSyncCommit() { @@ -36,5 +45,8 @@ func (wb *WriteBatch) Commit() error { } func (wb *WriteBatch) Rollback() error { + wb.putNum = 0 + wb.deleteNum = 0 + return wb.wb.Rollback() } From e343ca0dc0d881da9ea79d7218930c464796f3a4 Mon Sep 17 00:00:00 2001 From: siddontang Date: Fri, 31 Oct 2014 20:33:32 +0800 Subject: [PATCH 3/3] fix type --- config/config.go | 2 +- etc/ledis.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index f11c335..e75bca4 100644 --- a/config/config.go +++ b/config/config.go @@ -113,7 +113,7 @@ type Config struct { ConnReadBufferSize int `toml:"conn_read_buffer_size"` ConnWriteBufferSize int `toml:"conn_write_buffer_size"` - ConnKeepaliveInterval int `toml:"conn_keepavlie_interval"` + ConnKeepaliveInterval int `toml:"conn_keepalive_interval"` TTLCheckInterval int `toml:"ttl_check_interval"` } diff --git a/etc/ledis.conf b/etc/ledis.conf index 6b6722b..f75c784 100644 --- a/etc/ledis.conf +++ b/etc/ledis.conf @@ -50,7 +50,7 @@ conn_write_buffer_size = 10240 # if connection receives no data after n seconds, it may be dead, close # 0 to disable and not check -conn_keepavlie_interval = 0 +conn_keepalive_interval = 0 # checking TTL (time to live) data every n seconds # if you set big, the expired data may not be deleted immediately