Commit 9f611b57 authored by jan.koester's avatar jan.koester
Browse files

test

parent f5151513
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@ mediadb (20260503+1) unstable; urgency=medium

  * cluster: recreate import_client_ on retry to reset paritypp node error
    counters when cluster recovers (reset_import_client vs warmup-only)
  * cluster: fall back to pclient_ for media replication if import_client_
    is persistently broken but cluster is otherwise healthy

 -- Jan Koester <jan.koester@tuxist.de>  Sat, 03 May 2026 17:00:00 +0200

+10 −1
Original line number Diff line number Diff line
@@ -3117,7 +3117,8 @@ std::unique_ptr<ImportSession> ClusterMediaBackend::begin_import() {
    importing_.store(true);

    // Synchronous replicate: use pclient_ for metadata (store/index),
    // import_client_ for media data. Retry with warmup on failure.
    // import_client_ for media data. Retry with reset on failure;
    // final fallback uses pclient_ in case import_client_ is persistently broken.
    auto replicate_fn = [this](const std::string& key, const uint8_t* d, size_t len) -> bool {
        static constexpr int MAX_RETRIES = 3;
        const bool use_pclient = (key == "index" || key.compare(0, 6, "store:") == 0);
@@ -3136,6 +3137,14 @@ std::unique_ptr<ImportSession> ClusterMediaBackend::begin_import() {
                                  : cluster_.replicate_import(key, d, len);
            if (ok) return true;
        }
        // import_client_ persistently broken — fall back to pclient_ so we
        // don't drop the file when the cluster is otherwise healthy.
        if (!use_pclient) {
            std::cerr << "[CLUSTER-IMPORT-STREAM] import_client_ exhausted, "
                         "falling back to pclient_ for key=" << key << "\n";
            cluster_.warmup_read_clients();
            if (cluster_.replicate(key, d, len)) return true;
        }
        std::cerr << "[CLUSTER-IMPORT-STREAM] replicate FAILED key=" << key << "\n";
        return false;
    };