Skip to content
Snippets Groups Projects
Commit 4b5d9548 authored by Dmitry Simonenko's avatar Dmitry Simonenko
Browse files

opentar-56: big files and Delete v1.3 support

parent e81e2842
No related branches found
No related tags found
No related merge requests found
...@@ -44,12 +44,12 @@ ts_cursor_open(struct ts_cursor *c, struct ts_key *k) ...@@ -44,12 +44,12 @@ ts_cursor_open(struct ts_cursor *c, struct ts_key *k)
} }
rc = tnt_log_seek(&c->current, k->offset); rc = tnt_log_seek(&c->current, k->offset);
if (rc == -1) { if (rc == -1) {
printf("failed to seek for: %s:%d\n", c->r->file, k->offset); printf("failed to seek for: %s:%"PRIu64"\n", c->r->file, k->offset);
tnt_log_close(&c->current); tnt_log_close(&c->current);
return -1; return -1;
} }
if (tnt_log_next(&c->current) == NULL) { if (tnt_log_next(&c->current) == NULL) {
printf("failed to read: %s:%d\n", c->r->file, k->offset); printf("failed to read: %s:%"PRIu64"\n", c->r->file, k->offset);
tnt_log_close(&c->current); tnt_log_close(&c->current);
return -1; return -1;
} }
...@@ -69,9 +69,12 @@ ts_cursor_tuple(struct ts_cursor *c) ...@@ -69,9 +69,12 @@ ts_cursor_tuple(struct ts_cursor *c)
case TNT_OP_INSERT: case TNT_OP_INSERT:
t = &rp->r.insert.t; t = &rp->r.insert.t;
break; break;
case TNT_OP_DELETE_1_3:
t = &rp->r.del_1_3.t;
return t;
case TNT_OP_DELETE: case TNT_OP_DELETE:
t = &rp->r.del.t; t = &rp->r.del.t;
return 0; return t;
case TNT_OP_UPDATE: case TNT_OP_UPDATE:
assert(0); assert(0);
break; break;
......
...@@ -57,7 +57,7 @@ search_equal(const struct ts_key *a, ...@@ -57,7 +57,7 @@ search_equal(const struct ts_key *a,
} }
static int static int
snapshot_process_row(struct ts_spaces *s, int fileid, int offset, snapshot_process_row(struct ts_spaces *s, int fileid, uint64_t offset,
struct tnt_iter_storage *is, struct tnt_iter_storage *is,
struct tnt_stream_snapshot *ss) struct tnt_stream_snapshot *ss)
{ {
...@@ -163,7 +163,8 @@ snapdir_process(void) ...@@ -163,7 +163,8 @@ snapdir_process(void)
} }
static int static int
xlog_process_row(struct ts_spaces *s, int fileid, int offset, struct tnt_request *r) xlog_process_row(struct ts_spaces *s, int fileid, uint64_t offset,
struct tnt_request *r)
{ {
/* validate operation */ /* validate operation */
uint32_t ns = 0; uint32_t ns = 0;
...@@ -178,6 +179,10 @@ xlog_process_row(struct ts_spaces *s, int fileid, int offset, struct tnt_request ...@@ -178,6 +179,10 @@ xlog_process_row(struct ts_spaces *s, int fileid, int offset, struct tnt_request
ns = r->r.del.h.ns; ns = r->r.del.h.ns;
t = &r->r.del.t; t = &r->r.del.t;
break; break;
case TNT_OP_DELETE_1_3:
ns = r->r.del_1_3.h.ns;
t = &r->r.del_1_3.t;
break;
case TNT_OP_UPDATE: case TNT_OP_UPDATE:
ns = r->r.update.h.ns; ns = r->r.update.h.ns;
t = &r->r.update.t; t = &r->r.update.t;
...@@ -214,6 +219,7 @@ xlog_process_row(struct ts_spaces *s, int fileid, int offset, struct tnt_request ...@@ -214,6 +219,7 @@ xlog_process_row(struct ts_spaces *s, int fileid, int offset, struct tnt_request
} }
ts_oomcheck(); ts_oomcheck();
break; break;
case TNT_OP_DELETE_1_3:
case TNT_OP_DELETE: { case TNT_OP_DELETE: {
pos = mh_pk_get(space->index, &node, space); pos = mh_pk_get(space->index, &node, space);
assert(pos != mh_end(space->index)); assert(pos != mh_end(space->index));
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#define TS_KEY_WITH_DATA 1 #define TS_KEY_WITH_DATA 1
struct ts_key { struct ts_key {
uint32_t file; uint16_t file;
uint32_t offset; uint64_t offset;
uint8_t flags; uint8_t flags;
unsigned char key[]; unsigned char key[];
} __attribute__((packed)); } __attribute__((packed));
......
...@@ -88,11 +88,11 @@ ts_snapshot_xfer(FILE *snapshot, struct tnt_log *current, ...@@ -88,11 +88,11 @@ ts_snapshot_xfer(FILE *snapshot, struct tnt_log *current,
{ {
int rc = tnt_log_seek(current, k->offset); int rc = tnt_log_seek(current, k->offset);
if (rc == -1) { if (rc == -1) {
printf("failed to seek for: %s:%d\n", r->file, k->offset); printf("failed to seek for: %s:%"PRIu64"\n", r->file, k->offset);
return -1; return -1;
} }
if (tnt_log_next(current) == NULL) { if (tnt_log_next(current) == NULL) {
printf("failed to read: %s:%d\n", r->file, k->offset); printf("failed to read: %s:%"PRIu64"\n", r->file, k->offset);
return -1; return -1;
} }
...@@ -106,8 +106,10 @@ ts_snapshot_xfer(FILE *snapshot, struct tnt_log *current, ...@@ -106,8 +106,10 @@ ts_snapshot_xfer(FILE *snapshot, struct tnt_log *current,
case TNT_OP_INSERT: case TNT_OP_INSERT:
t = &rp->r.insert.t; t = &rp->r.insert.t;
break; break;
case TNT_OP_DELETE_1_3:
case TNT_OP_DELETE: case TNT_OP_DELETE:
t = &rp->r.del.t; /* skip */
//t = &rp->r.del.t;
return 0; return 0;
case TNT_OP_UPDATE: case TNT_OP_UPDATE:
assert(0); assert(0);
......
...@@ -252,7 +252,7 @@ int ts_space_fill(struct ts_spaces *s, struct ts_options *opts) ...@@ -252,7 +252,7 @@ int ts_space_fill(struct ts_spaces *s, struct ts_options *opts)
static inline struct ts_key* static inline struct ts_key*
ts_space_keyalloc_sha(struct ts_space *s, struct tnt_tuple *t, int fileid, ts_space_keyalloc_sha(struct ts_space *s, struct tnt_tuple *t, int fileid,
int offset, int attach) uint64_t offset, int attach)
{ {
int size = sizeof(struct ts_key) + s->key_size; int size = sizeof(struct ts_key) + s->key_size;
if (attach) if (attach)
...@@ -297,7 +297,7 @@ ts_space_keyalloc_sha(struct ts_space *s, struct tnt_tuple *t, int fileid, ...@@ -297,7 +297,7 @@ ts_space_keyalloc_sha(struct ts_space *s, struct tnt_tuple *t, int fileid,
static inline struct ts_key* static inline struct ts_key*
ts_space_keyalloc_sparse(struct ts_space *s, struct tnt_tuple *t, int fileid, ts_space_keyalloc_sparse(struct ts_space *s, struct tnt_tuple *t, int fileid,
int offset, int attach) uint64_t offset, int attach)
{ {
int size = sizeof(struct ts_key) + s->key_size; int size = sizeof(struct ts_key) + s->key_size;
if (attach) if (attach)
...@@ -341,7 +341,7 @@ ts_space_keyalloc_sparse(struct ts_space *s, struct tnt_tuple *t, int fileid, ...@@ -341,7 +341,7 @@ ts_space_keyalloc_sparse(struct ts_space *s, struct tnt_tuple *t, int fileid,
struct ts_key* struct ts_key*
ts_space_keyalloc(struct ts_space *s, struct tnt_tuple *t, int fileid, ts_space_keyalloc(struct ts_space *s, struct tnt_tuple *t, int fileid,
int offset, int attach) uint64_t offset, int attach)
{ {
struct ts_key *k = NULL; struct ts_key *k = NULL;
switch (s->c) { switch (s->c) {
......
...@@ -48,7 +48,7 @@ int ts_space_fill(struct ts_spaces *s, struct ts_options *opts); ...@@ -48,7 +48,7 @@ int ts_space_fill(struct ts_spaces *s, struct ts_options *opts);
struct ts_key* struct ts_key*
ts_space_keyalloc(struct ts_space *s, struct tnt_tuple *t, int fileid, ts_space_keyalloc(struct ts_space *s, struct tnt_tuple *t, int fileid,
int offset, int attach); uint64_t offset, int attach);
void void
ts_space_keyfree(struct ts_space *s, struct ts_key *k); ts_space_keyfree(struct ts_space *s, struct ts_key *k);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment