static int tc_wal_printer_from_rpl(struct tnt_iter *i) { struct tnt_request *r = TNT_IREQUEST_PTR(i); struct tnt_stream_rpl *s = TNT_RPL_CAST(TNT_IREQUEST_STREAM(i)); tc_wal_print(&s->hdr, r); return 0; }
static int tc_wal_printer(struct tnt_iter *i) { struct tnt_request *r = TNT_IREQUEST_PTR(i); struct tnt_stream_xlog *s = TNT_SXLOG_CAST(TNT_IREQUEST_STREAM(i)); tc_wal_print(&s->hdr, r); return 0; }
int tc_verify_process(struct tc_spaces *s, uint64_t lsn, char *snap_dir) { char path[1024]; snprintf(path, sizeof(path), "%s/%020llu.snap", snap_dir, (long long unsigned)lsn); printf("(snapshot) %s\n", path); struct tnt_stream st; tnt_snapshot(&st); if (tnt_snapshot_open(&st, path) == -1) { printf("failed to open snapshot file\n"); tnt_stream_free(&st); return -1; } struct tnt_iter i; tnt_iter_storage(&i, &st); int errors = 0; int rc = 0; while (tnt_next(&i)) { struct tnt_iter_storage *is = TNT_ISTORAGE(&i); struct tnt_stream_snapshot *ss = TNT_SSNAPSHOT_CAST(TNT_IREQUEST_STREAM(&i)); int result = tc_verify_cmp(s, lsn, is, ss); if (result == -1) errors++; } if (i.status == TNT_ITER_FAIL) { printf("snapshot parsing failed: %s\n", tnt_snapshot_strerror(&st)); rc = -1; } if (errors) rc = -1; tnt_iter_free(&i); tnt_stream_free(&st); return rc; }