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

test

parent f6053b1d
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -2980,12 +2980,15 @@ bool ClusterMediaBackend::import_db_from_buffer(const std::uint8_t* data, std::s
                      << " key=" << key << " size=" << l << "\n";
        constexpr int MAX_RETRIES = 3;
        for (int attempt = 1; attempt <= MAX_RETRIES; ++attempt) {
            // Warmup connections before each attempt — they may have gone
            // stale during a long import with many media entries.
            if (attempt > 1) {
                // Warmup on retry only — first attempt uses existing
                // connections; warming up concurrently with health_loop
                // causes use-after-free on pclient_ internals.
                cluster_.warmup_read_clients();
                std::this_thread::sleep_for(std::chrono::seconds(attempt - 1));
            }
            if (cluster_.replicate(key, d, l)) return;
            std::cerr << "[CLUSTER-IMPORT] retry " << attempt << " key=" << key << "\n";
            std::this_thread::sleep_for(std::chrono::seconds(attempt));
        }
        std::cerr << "[CLUSTER-IMPORT] FAILED key=" << key << " after retries\n";
        ++repl_fail;
@@ -3046,15 +3049,15 @@ std::unique_ptr<ImportSession> ClusterMediaBackend::begin_import() {
                          << " key=" << key << " size=" << len << "\n";
                std::this_thread::sleep_for(
                    std::chrono::milliseconds(500 * (1 << (attempt - 1))));
            }
            // Always warmup before each attempt — pclient_ connections go
            // stale during long streaming imports (QUIC idle timeout) and
            // import_client_ can similarly lose connections between entries.
                // Warmup on retry only — first attempt uses existing
                // connections; warming up concurrently with health_loop
                // causes use-after-free on pclient_ internals.
                if (use_pclient) {
                    cluster_.warmup_read_clients();
                } else {
                    cluster_.warmup_import_client();
                }
            }
            std::cerr << "[CLUSTER-IMPORT-STREAM] replicate key=" << key << " size=" << len
                      << " via " << (use_pclient ? "pclient" : "import_client") << "\n";
            bool ok = use_pclient ? cluster_.replicate(key, d, len)