Change Redwood to use xxhash for checksums.

This commit is contained in:
Steve Atherton 2021-11-02 21:47:31 -07:00
parent c913f89227
commit 84854761cb
2 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@
#include "flow/flow.h"
#include "fdbclient/FDBTypes.h"
#include "flow/crc32c.h"
#include "flow/xxhash.h"
#ifndef VALGRIND
#define VALGRIND_MAKE_MEM_UNDEFINED(x, y)
@ -101,7 +101,7 @@ public:
uint8_t* mutate() { return (uint8_t*)buffer; }
typedef uint32_t Checksum;
typedef XXH64_hash_t Checksum;
// Usable size, without checksum
int size() const { return logicalSize - sizeof(Checksum); }
@ -143,7 +143,7 @@ public:
Checksum& getChecksum() { return *(Checksum*)(buffer + size()); }
Checksum calculateChecksum(LogicalPageID pageID) { return crc32c_append(pageID, buffer, size()); }
Checksum calculateChecksum(LogicalPageID pageID) { return XXH3_64bits_withSeed(buffer, size(), pageID); }
void updateChecksum(LogicalPageID pageID) { getChecksum() = calculateChecksum(pageID); }

View File

@ -3629,7 +3629,7 @@ private:
#pragma pack(push, 1)
// Header is the format of page 0 of the database
struct Header {
static constexpr int FORMAT_VERSION = 7;
static constexpr int FORMAT_VERSION = 8;
uint16_t formatVersion;
uint32_t queueCount;
uint32_t pageSize;
@ -4601,7 +4601,7 @@ public:
#pragma pack(push, 1)
struct MetaKey {
static constexpr int FORMAT_VERSION = 14;
static constexpr int FORMAT_VERSION = 15;
// This serves as the format version for the entire tree, individual pages will not be versioned
uint16_t formatVersion;
uint8_t height;