Commit 006f90ef authored by jan.koester's avatar jan.koester
Browse files

test

parent aef420c6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
libparitypp (20260405+20) unstable; urgency=medium

  * Add VACUUM protocol command (0x07) for remote block store compaction
  * Move vacuum() to block_store base class (default no-op, file_block_store
    overrides)
  * Add client::vacuum_all_nodes() to broadcast VACUUM to all cluster peers

 -- Jan Koester <jan.koester@tuxist.de>  Sun, 05 Apr 2026 00:00:00 +0000

libparitypp (20260404+19) unstable; urgency=medium

  * Replace busy-spin accept loop with poll-based waitRead (fixes 100% CPU
+4 −0
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ public:
    // List all group IDs stored on a specific node
    bool list_groups_on_node(size_t node_index, std::vector<uint64_t>& groups);

    // Compact block stores on all nodes, reclaiming space from deleted records.
    // Returns number of nodes that completed vacuum successfully.
    size_t vacuum_all_nodes();

    // Designate a node index as "local" — bypass QUIC, use block_store directly
    void set_local_node(size_t node_index, std::shared_ptr<block_store> store);

+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ enum class msg_type : uint8_t {
    LIST_BLOCKS    = 0x04, // List blocks in group: [8B block_group_id]
    GET_STATUS     = 0x05, // Get node status
    LIST_GROUPS    = 0x06, // List all groups: no payload
    VACUUM         = 0x07, // Compact block store: no payload
    AUTH_REQUEST   = 0x10, // Auth request: [1B name_len][name_bytes]
    AUTH_RESPONSE  = 0x11, // Auth response: [32B HMAC-SHA256(key, nonce)]

+5 −1
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@ public:

    // List all group IDs in the store
    virtual std::vector<uint64_t> list_groups() = 0;

    // Compact the store, reclaiming space from deleted records.
    // Returns true on success. Default implementation is a no-op.
    virtual bool vacuum() { return true; }
};

// In-memory block store for testing/lightweight usage
@@ -77,7 +81,7 @@ public:

    // Rewrite the data file, dropping deleted records to reclaim space.
    // Returns true on success.
    bool vacuum();
    bool vacuum() override;

private:
    static constexpr uint8_t RECORD_LIVE    = 0x00;
+22 −0
Original line number Diff line number Diff line
@@ -876,4 +876,26 @@ void client::set_local_node(size_t node_index, std::shared_ptr<block_store> stor
    local_store_ = std::move(store);
}

size_t client::vacuum_all_nodes() {
    size_t ok_count = 0;
    for (size_t i = 0; i < nodes_.size(); i++) {
        try {
            if (static_cast<int>(i) == local_node_index_ && local_store_) {
                if (local_store_->vacuum()) ++ok_count;
                continue;
            }
            auto resp = send_recv(i, msg_type::VACUUM, {});
            if (resp.size() >= protocol::HEADER_SIZE) {
                msg_type rtype;
                uint32_t rlen;
                if (protocol::decode_header(resp.data(), resp.size(), rtype, rlen)
                    && rtype == msg_type::OK) {
                    ++ok_count;
                }
            }
        } catch (...) {}
    }
    return ok_count;
}

} // namespace paritypp
Loading