提交 909e5fbd 编写于 作者: J Jiawei Wang 提交者: GitHub

Merge pull request #98 from Badangel/cube-builder

fix flush data and index overwrite file
...@@ -180,7 +180,7 @@ bool CROVLBuilderIncremental::flush_data() { ...@@ -180,7 +180,7 @@ bool CROVLBuilderIncremental::flush_data() {
char file[MAX_DATA_DIR_LEN * 2]; char file[MAX_DATA_DIR_LEN * 2];
snprintf(file, sizeof(file), "%s/data.%lu", _data_dir, _data_file); snprintf(file, sizeof(file), "%s/data.%lu", _data_dir, _data_file);
FILE *fp; FILE *fp;
if ((fp = fopen(file, "wb")) == NULL) { if ((fp = fopen(file, "ab")) == NULL) {
LOG(ERROR) << "open file failed! " << file; LOG(ERROR) << "open file failed! " << file;
return false; return false;
} }
...@@ -209,7 +209,7 @@ bool CROVLBuilderIncremental::FlushIndex() { ...@@ -209,7 +209,7 @@ bool CROVLBuilderIncremental::FlushIndex() {
char file[MAX_DATA_DIR_LEN * 2]; char file[MAX_DATA_DIR_LEN * 2];
snprintf(file, sizeof(file), "%s/index.%d", _data_dir, _index_file_num); snprintf(file, sizeof(file), "%s/index.%d", _data_dir, _index_file_num);
FILE *fp; FILE *fp;
if ((fp = fopen(file, "wb")) == NULL) { if ((fp = fopen(file, "ab")) == NULL) {
LOG(ERROR) << "open file failed! " << file; LOG(ERROR) << "open file failed! " << file;
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册