From 4560490d36695d3e1a84f499946d94570bbef800 Mon Sep 17 00:00:00 2001 From: Doug Hoyte Date: Sat, 14 Sep 2024 10:10:59 -0400 Subject: [PATCH] detect and prevent an export of a v2 DB using --fried (it will be corrupted) --- src/apps/dbutils/cmd_export.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/apps/dbutils/cmd_export.cpp b/src/apps/dbutils/cmd_export.cpp index aae25b0..76f81cc 100644 --- a/src/apps/dbutils/cmd_export.cpp +++ b/src/apps/dbutils/cmd_export.cpp @@ -30,6 +30,11 @@ void cmd_export(const std::vector &subArgs) { if (dbVersion == 0) throw herr("migration from DB version 0 not supported by this version of strfry"); + if (fried) { + if (std::endian::native != std::endian::little) throw herr("--fried currently only supported on little-endian CPUs"); // FIXME + if (dbVersion < 3) throw herr("can't export old DB version with --fried: please downgrade to 0.9.7"); + } + uint64_t start = reverse ? until : since; uint64_t startDup = reverse ? MAX_U64 : 0; @@ -48,8 +53,6 @@ void cmd_export(const std::vector &subArgs) { std::string_view json = getEventJson(txn, decomp, levId); if (fried) { - if (std::endian::native != std::endian::little) throw herr("--fried currently only supported on little-endian CPUs"); // FIXME - auto ev = lookupEventByLevId(txn, levId); o.clear();