Permalink
Browse files

Add: background merge count to INFO command

  • Loading branch information...
1 parent 482ead3 commit 3864a477e8235b03ae79e4c6c4093c8f7b960dc0 @BohuTANG committed Feb 20, 2012
Showing with 10 additions and 3 deletions.
  1. +1 −0 CHANGELOG
  2. +5 −3 engine/db.c
  3. +3 −0 engine/index.c
  4. +1 −0 engine/index.h
View
@@ -1,3 +1,4 @@
+2012-02-20 add INFO command. (BohuTANG)
2011-12-29 add slim 'read-lock' and 'write-lock',and add LLRU, this is a big deal. (BohuTANG)
2011-12-25 add 'background-merge' thread, Merry christmas. (BohuTANG)
View
@@ -85,7 +85,7 @@ char *db_info(struct nessdb *db)
time_t uptime = time(NULL) - db->start_time;
buffer_clear(db->buf);
buffer_scatf(db->buf,
- "#Server\r\n"
+ "# Server\r\n"
"gcc_version:%d.%d.%d\r\n"
"process_id:%ld\r\n"
"uptime_in_seconds:%ld\r\n"
@@ -99,7 +99,8 @@ char *db_info(struct nessdb *db)
"total_lru_hot_memory_usage:%d(MB)\r\n"
"total_lru_cold_meomry_usage:%d(MB)\r\n"
"max_allow_lru_memory_usage:%d(MB)\r\n\r\n"
- "total_memtable_count:%d\r\n",
+ "total_memtable_count:%d\r\n"
+ "total_background_merge_count:%d\r\n",
#ifdef __GNUC__
__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__,
#else
@@ -117,7 +118,8 @@ char *db_info(struct nessdb *db)
db->lru->level_old.used_size / (1024 * 1024),
(db->lru->level_old.allow_size + db->lru->level_new.allow_size) / (1024 * 1024),
- db->idx->list->count);
+ db->idx->list->count,
+ db->idx->bg_merge_count);
return buffer_detach(db->buf);
}
View
@@ -50,6 +50,8 @@ void *_merge_job(void *arg)
sst = idx->sst;
log = idx->log;
+ idx->bg_merge_count++;
+
if(list == NULL)
goto merge_out;
@@ -78,6 +80,7 @@ struct index *index_new(const char *basedir, const char *name, int max_mtbl_size
ensure_dir_exists(dir);
idx->lsn = 0;
+ idx->bg_merge_count = 0;
idx->max_mtbl = 1;
idx->max_mtbl_size = max_mtbl_size;
memset(idx->basedir, 0, INDEX_NSIZE);
View
@@ -22,6 +22,7 @@ struct index{
int lsn;
int db_rfd;
int meta_lsn;
+ int bg_merge_count;
int max_mtbl;
int max_mtbl_size;

0 comments on commit 3864a47

Please sign in to comment.