-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcouch_dotori.cc
646 lines (550 loc) · 19 KB
/
couch_dotori.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
#include <deque>
#include <mutex>
#include <thread>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <atomic>
#include "arch.h"
#include "libforestdb/forestdb.h"
#include "libcouchstore/couch_db.h"
#include "stopwatch.h"
#include "memleak.h"
#define META_BUF_MAXLEN (256)
#define SEQNUM_NOT_USED (0xffffffffffffffff)
#define MAX_KEYLEN (4096)
extern int64_t DATABUF_MAXLEN;
struct _db {
fdb_file_handle *dbfile;
fdb_kvs_handle *fdb;
char *filename;
};
static uint64_t config_flags = 0x0;
static uint64_t kv_cache_size = 8192LU << 20;
static uint64_t bcache_size = 12288LU << 20;
static uint64_t index_bsize = 4096;
static int c_auto = 0;
static size_t c_threshold = 83;
static size_t br_threshold = 65;
static size_t wal_size = 4096;
static size_t c_period = 0;
static int compression = 0;
static int indexing_type = 0;
static int auto_compaction_threads = 0;
static int max_logs = 4;
static int retrieve_length = 4096;
static int num_aio_workers = 3;
static int max_outstanding = 24;
static int g_commit_wait = 50;
static bool cache_kv_pairs = true;
static bool deletes = false;
couchstore_error_t couchstore_set_flags(uint64_t flags) {
config_flags = flags;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_idx_type(int type) {
indexing_type = type;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_cache(uint64_t size) {
kv_cache_size = size;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_bcache(uint64_t size) {
bcache_size = size;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_index_bsize(uint64_t size) {
index_bsize = size;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_cache_kv_pairs(bool _cache) {
cache_kv_pairs = _cache;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_compaction(int mode,
size_t compact_thres,
size_t block_reuse_thres) {
c_auto = mode;
c_threshold = compact_thres;
br_threshold = block_reuse_thres;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_auto_compaction_threads(int num_threads) {
auto_compaction_threads = num_threads;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_wal_size(size_t size) {
wal_size = size;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_close_conn() {
fdb_shutdown();
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_chk_period(size_t seconds) {
c_period = seconds;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_compression(int opt) {
compression = opt;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_max_logs(uint32_t _max_logs) {
max_logs = _max_logs;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_retrieve_length(uint32_t _ret_len) {
retrieve_length = _ret_len;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_num_aio_workers(uint32_t num) {
num_aio_workers = num;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_max_outstanding(uint32_t max) {
max_outstanding = max;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_g_commit_wait(uint32_t _g_commit_wait) {
g_commit_wait = _g_commit_wait;
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_ycsbd(bool _d) {
return COUCHSTORE_SUCCESS;
}
couchstore_error_t couchstore_set_deletes(bool _del) {
deletes = _del;
return COUCHSTORE_SUCCESS;
}
void logCallbackFunc(int err_code,
const char *err_msg,
void *pCtxData) {
fprintf(stderr, "%s - error code: %d, error message: %s\n",
(char *) pCtxData, err_code, err_msg);
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_open_db(const char *filename,
couchstore_open_flags flags,
Db **pDb)
{
return couchstore_open_db_ex(filename, flags,
NULL, pDb);
}
bool closed = false;
LIBCOUCHSTORE_API
couchstore_error_t couchstore_open_db_ex(const char *filename,
couchstore_open_flags flags,
FileOpsInterface *ops,
Db **pDb)
{
fdb_config config;
fdb_kvs_config kvs_config;
fdb_status status;
fdb_file_handle *dbfile;
fdb_kvs_handle *fdb;
char *fname = (char *)filename;
closed = false;
memset(&config, 0, sizeof(fdb_config));
config = fdb_get_default_config_kvssd();
config.kvssd = true;
config.kv_cache_doc_writes = cache_kv_pairs;
if (c_auto) {
config.compaction_mode = FDB_COMPACTION_AUTO;
config.deletion_interval = c_period;
} else {
config.compaction_mode = FDB_COMPACTION_MANUAL;
}
config.block_reusing_threshold = 0;
config.num_compactor_threads = 1;
config.logging = true;
config.num_aio_workers = 3;
config.max_outstanding = 24;
config.max_logs_per_node = max_logs;
config.kvssd_retrieve_length = retrieve_length;
config.blocksize = 4096;
config.index_blocksize = index_bsize;
config.chunksize = sizeof(uint64_t);
config.kv_cache_size = kv_cache_size;
config.buffercache_size = bcache_size;
config.wal_threshold = wal_size;
config.num_wal_partitions = 31;
config.num_bcache_partitions = 31;
config.seqtree_opt = FDB_SEQTREE_NOT_USE;
config.num_bgflusher_threads = 0;
if (flags & 0x10) {
config.durability_opt = FDB_DRB_NONE;
} else {
config.durability_opt = FDB_DRB_ASYNC;
}
config.compress_document_body = (compression)?true:false;
config.wal_flush_before_commit = false;
config.auto_commit = false;
config.prefetch_duration = 0;
config.multi_kv_instances = false;
kvs_config = fdb_get_default_kvs_config();
*pDb = (Db*)calloc(1, sizeof(Db));
(*pDb)->filename = (char *)malloc(strlen(filename)+1);
strcpy((*pDb)->filename, filename);
if (indexing_type == 1) {
assert(0);
// naive B+tree
//char *kvs_names[] = {(char*)"default"};
//fdb_custom_cmp_variable functions[] = {_bench_keycmp};
//config.multi_kv_instances = true;
//status = fdb_open_custom_cmp(&dbfile, fname, &config,
// 1, kvs_names, functions);
} else {
status = fdb_open(&dbfile, fname, &config);
assert(status == FDB_RESULT_SUCCESS);
}
status = fdb_kvs_open_default(dbfile, &fdb, &kvs_config);
assert(status == FDB_RESULT_SUCCESS);
(*pDb)->dbfile = dbfile;
(*pDb)->fdb = fdb;
if (status == FDB_RESULT_SUCCESS) {
return COUCHSTORE_SUCCESS;
} else {
free((*pDb)->filename);
free(*pDb);
return COUCHSTORE_ERROR_OPEN_FILE;
}
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_close_db(Db *db)
{
fdb_commit(db->dbfile, FDB_COMMIT_MANUAL_WAL_FLUSH);
fdb_close(db->dbfile);
fdb_shutdown();
return COUCHSTORE_SUCCESS;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_db_info(Db *db, DbInfo* info)
{
fdb_file_info fdb_info;
fdb_get_file_info(db->dbfile, &fdb_info);
info->file_size = fdb_info.file_size;
info->space_used = fdb_info.space_used;
info->filename = fdb_info.filename;
info->app_wa = fdb_info.app_write_amp;
return COUCHSTORE_SUCCESS;
}
size_t _docinfo_to_buf(DocInfo *docinfo, void *buf)
{
// [db_seq,] rev_seq, deleted, content_meta, rev_meta (size), rev_meta (buf)
size_t offset = 0;
memcpy((uint8_t*)buf + offset, &docinfo->rev_seq, sizeof(docinfo->rev_seq));
offset += sizeof(docinfo->rev_seq);
memcpy((uint8_t*)buf + offset, &docinfo->deleted, sizeof(docinfo->deleted));
offset += sizeof(docinfo->deleted);
memcpy((uint8_t*)buf + offset, &docinfo->content_meta, sizeof(docinfo->content_meta));
offset += sizeof(docinfo->content_meta);
memcpy((uint8_t*)buf + offset, &docinfo->rev_meta.size, sizeof(docinfo->rev_meta.size));
offset += sizeof(docinfo->rev_meta.size);
if (docinfo->rev_meta.size > 0) {
memcpy((uint8_t*)buf + offset, docinfo->rev_meta.buf, docinfo->rev_meta.size);
offset += docinfo->rev_meta.size;
}
return offset;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_save_documents(Db *db, Doc* const docs[], DocInfo *infos[],
unsigned numdocs, couchstore_save_options options)
{
unsigned i;
fdb_doc _doc;
fdb_status status = FDB_RESULT_SUCCESS;
uint8_t buf[DATABUF_MAXLEN];
memset(&_doc, 0, sizeof(_doc));
for (i=0;i<numdocs;++i){
_doc.key = docs[i]->id.buf;
_doc.keylen = docs[i]->id.size;
_doc.body = docs[i]->data.buf;
_doc.bodylen = docs[i]->data.size;
_doc.metalen = _docinfo_to_buf(infos[i], buf);
_doc.meta = buf;
_doc.metalen = 0;
_doc.meta = NULL;
_doc.deleted = 0;
status = fdb_set(db->fdb, &_doc);
memcpy(buf, docs[i]->data.buf, docs[i]->data.size);
assert(status == FDB_RESULT_SUCCESS);
infos[i]->db_seq = _doc.seqnum;
infos[i]->bp = _doc.offset;
}
if (status == FDB_RESULT_SUCCESS)
return COUCHSTORE_SUCCESS;
else
return COUCHSTORE_ERROR_ALLOC_FAIL;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_save_document(Db *db, const Doc *doc, DocInfo *info,
couchstore_save_options options)
{
return couchstore_save_documents(db, (Doc**)&doc, (DocInfo**)&info, 1, options);
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_save_documents_rmw(Db *db, Doc* const docs[],
DocInfo *infos[],
unsigned numdocs, couchstore_save_options options)
{
unsigned i;
fdb_doc _doc;
fdb_status status = FDB_RESULT_SUCCESS;
uint8_t buf[META_BUF_MAXLEN];
int idx;
memset(&_doc, 0, sizeof(_doc));
for (i=0;i<numdocs;++i){
memset(&_doc, 0, sizeof(_doc));
_doc.key = (void *)docs[i]->id.buf;
_doc.keylen = docs[i]->id.size;
_doc.seqnum = SEQNUM_NOT_USED;
_doc.meta = _doc.body = NULL;
status = fdb_get(db->fdb, &_doc);
if (status != FDB_RESULT_SUCCESS) {
assert(0);
return COUCHSTORE_ERROR_DOC_NOT_FOUND;
}
idx = rand() % _doc.bodylen;
((char*) _doc.body)[idx] = 'A';
status = fdb_set(db->fdb, &_doc);
if (status != FDB_RESULT_SUCCESS) {
assert(0);
return COUCHSTORE_ERROR_ALLOC_FAIL;
}
free(_doc.body);
}
if (status == FDB_RESULT_SUCCESS)
return COUCHSTORE_SUCCESS;
else
return COUCHSTORE_ERROR_ALLOC_FAIL;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_save_document_rmw(Db *db, const Doc *doc, DocInfo *info,
couchstore_save_options options)
{
return couchstore_save_documents_rmw(db, (Doc**)&doc, (DocInfo**)&info, 1, options);
}
void _buf_to_docinfo(void *buf, size_t size, DocInfo *docinfo)
{
size_t offset = 0;
memcpy(&docinfo->rev_seq, (uint8_t*)buf + offset, sizeof(docinfo->rev_seq));
offset += sizeof(docinfo->rev_seq);
memcpy(&docinfo->deleted, (uint8_t*)buf + offset, sizeof(docinfo->deleted));
offset += sizeof(docinfo->deleted);
memcpy(&docinfo->content_meta, (uint8_t*)buf + offset, sizeof(docinfo->content_meta));
offset += sizeof(docinfo->content_meta);
memcpy(&docinfo->rev_meta.size, (uint8_t*)buf + offset, sizeof(docinfo->rev_meta.size));
offset += sizeof(docinfo->rev_meta.size);
if (docinfo->rev_meta.size > 0) {
//docinfo->rev_meta.buf = (char *)malloc(docinfo->rev_meta.size);
docinfo->rev_meta.buf = ((char *)docinfo) + sizeof(DocInfo);
memcpy(docinfo->rev_meta.buf, (uint8_t*)buf + offset, docinfo->rev_meta.size);
offset += docinfo->rev_meta.size;
}else{
docinfo->rev_meta.buf = NULL;
}
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_docinfo_by_id(Db *db, const void *id, size_t idlen, DocInfo **pInfo)
{
fdb_doc _doc;
fdb_status status; (void)status;
size_t rev_meta_size;
size_t meta_offset;
meta_offset = sizeof(uint64_t)*1 + sizeof(int) + sizeof(couchstore_content_meta_flags);
_doc.key = (void *)id;
_doc.keylen = idlen;
_doc.seqnum = SEQNUM_NOT_USED;
_doc.meta = _doc.body = NULL;
status = fdb_get_metaonly(db->fdb, &_doc);
memcpy(&rev_meta_size, (uint8_t*)_doc.meta + meta_offset, sizeof(size_t));
*pInfo = (DocInfo *)malloc(sizeof(DocInfo) + rev_meta_size);
(*pInfo)->id.buf = (char *)id;
(*pInfo)->id.size = idlen;
(*pInfo)->size = _doc.bodylen;
(*pInfo)->bp = _doc.offset;
(*pInfo)->db_seq = _doc.seqnum;
_buf_to_docinfo(_doc.meta, _doc.metalen, (*pInfo));
free(_doc.meta);
return COUCHSTORE_SUCCESS;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_docinfos_by_id(Db *db, const sized_buf ids[], unsigned numDocs,
couchstore_docinfos_options options, couchstore_changes_callback_fn callback, void *ctx)
{
size_t i;
fdb_doc _doc;
fdb_status status;
DocInfo *docinfo;
size_t rev_meta_size, max_meta_size = 256;
size_t meta_offset;
(void)status;
meta_offset = sizeof(uint64_t)*1 + sizeof(int) + sizeof(couchstore_content_meta_flags);
docinfo = (DocInfo*)malloc(sizeof(DocInfo) + max_meta_size);
for (i=0;i<numDocs;++i){
_doc.key = (void*)ids[i].buf;
_doc.keylen = ids[i].size;
_doc.seqnum = SEQNUM_NOT_USED;
_doc.meta = _doc.body = NULL;
status = fdb_get_metaonly(db->fdb, &_doc);
assert(status == FDB_RESULT_SUCCESS);
memcpy(&rev_meta_size, (uint8_t*)_doc.meta + meta_offset, sizeof(size_t));
if (rev_meta_size > max_meta_size) {
max_meta_size = rev_meta_size;
docinfo = (DocInfo*)realloc(docinfo, sizeof(DocInfo) + max_meta_size);
}
memset(docinfo, 0, sizeof(DocInfo));
docinfo->id.buf = ids[i].buf;
docinfo->id.size = ids[i].size;
docinfo->size = _doc.bodylen;
docinfo->bp = _doc.offset;
docinfo->db_seq = _doc.seqnum;
_buf_to_docinfo(_doc.meta, _doc.metalen, docinfo);
free(_doc.meta);
callback(db, docinfo, ctx);
}
free(docinfo);
return COUCHSTORE_SUCCESS;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_docinfos_by_sequence(Db *db,
const uint64_t sequence[],
unsigned numDocs,
couchstore_docinfos_options options,
couchstore_changes_callback_fn callback,
void *ctx)
{
size_t i;
fdb_doc _doc;
fdb_status status;
DocInfo *docinfo;
size_t rev_meta_size, max_meta_size = 256;
size_t meta_offset;
uint8_t keybuf[MAX_KEYLEN];
(void)status;
meta_offset = sizeof(uint64_t)*1 + sizeof(int) + sizeof(couchstore_content_meta_flags);
docinfo = (DocInfo*)malloc(sizeof(DocInfo) + max_meta_size);
for (i=0;i<numDocs;++i){
_doc.key = (void*)keybuf;
_doc.seqnum = sequence[i];
_doc.meta = _doc.body = NULL;
status = fdb_get_metaonly_byseq(db->fdb, &_doc);
assert(status == FDB_RESULT_SUCCESS);
memcpy(&rev_meta_size, (uint8_t*)_doc.meta + meta_offset, sizeof(size_t));
if (rev_meta_size > max_meta_size) {
max_meta_size = rev_meta_size;
docinfo = (DocInfo*)realloc(docinfo, sizeof(DocInfo) + max_meta_size);
}
memset(docinfo, 0, sizeof(DocInfo));
docinfo->id.buf = (char *)keybuf;
docinfo->id.size = _doc.keylen;
docinfo->size = _doc.bodylen;
docinfo->bp = _doc.offset;
docinfo->db_seq = _doc.seqnum;
_buf_to_docinfo(_doc.meta, _doc.metalen, docinfo);
free(_doc.meta);
callback(db, docinfo, ctx);
}
free(docinfo);
return COUCHSTORE_SUCCESS;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_open_document(Db *db,
const void *id,
size_t idlen,
Doc **pDoc,
couchstore_open_options options)
{
fdb_doc _doc;
fdb_status status;
couchstore_error_t ret = COUCHSTORE_SUCCESS;
memset(&_doc, 0, sizeof(_doc));
_doc.key = (void *)id;
_doc.keylen = idlen;
_doc.seqnum = SEQNUM_NOT_USED;
_doc.meta = _doc.body = NULL;
status = fdb_get(db->fdb, &_doc);
if (status != FDB_RESULT_SUCCESS) {
printf("\nget error %.*s\n", (int)idlen, (char*)id);
fflush(stdout);
ret = COUCHSTORE_ERROR_DOC_NOT_FOUND;
assert(0);
}
//assert(status == FDB_RESULT_SUCCESS);
*pDoc = (Doc *)malloc(sizeof(Doc));
(*pDoc)->id.buf = (char*)_doc.key;
(*pDoc)->id.size = _doc.keylen;
(*pDoc)->data.buf = (char*)_doc.body;
(*pDoc)->data.size = _doc.bodylen;
free(_doc.meta);
return ret;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_walk_id_tree(Db *db,
const sized_buf* startDocID,
couchstore_docinfos_options options,
couchstore_walk_tree_callback_fn callback,
void *ctx)
{
int c_ret = 0;
fdb_iterator *fit = NULL;
fdb_status fs;
fdb_doc *doc;
DocInfo doc_info;
fs = fdb_iterator_init(db->fdb, &fit, startDocID->buf, startDocID->size, NULL, 0, 0x0);
if (fs != FDB_RESULT_SUCCESS) {
return COUCHSTORE_ERROR_DOC_NOT_FOUND;
}
do {
doc = NULL;
fs = fdb_iterator_get(fit, &doc);
if (fs == FDB_RESULT_SUCCESS) {
doc_info.id.buf = (char *)doc->key;
doc_info.id.size = doc->keylen;
c_ret = callback(db, 0, &doc_info, 0, NULL, ctx);
fs = fdb_doc_free(doc);
if (c_ret != 0) {
break;
}
} else {
break;
}
} while (fdb_iterator_next(fit) != FDB_RESULT_ITERATOR_FAIL);
fs = fdb_iterator_close(fit);
return COUCHSTORE_SUCCESS;
}
LIBCOUCHSTORE_API
void couchstore_free_document(Doc *doc)
{
if (doc->id.buf) free(doc->id.buf);
if (doc->data.buf) free(doc->data.buf);
free(doc);
}
LIBCOUCHSTORE_API
void couchstore_free_docinfo(DocInfo *docinfo)
{
free(docinfo);
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_commit(Db *db)
{
fdb_commit(db->dbfile, FDB_COMMIT_NORMAL);
return COUCHSTORE_SUCCESS;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_compact_db_ex(Db* source, const char* target_filename,
uint64_t flags, FileOpsInterface *ops)
{
char *new_filename = (char *)target_filename;
fdb_compact(source->dbfile, new_filename);
return COUCHSTORE_SUCCESS;
}
LIBCOUCHSTORE_API
couchstore_error_t couchstore_compact_db(Db* source, const char* target_filename)
{
return couchstore_compact_db_ex(source, target_filename, 0x0, NULL);
}