DiskQueue: use explicitly sized int32_t instead of int in on-disk format.

It was assumed that the payloadSize field in the page header was 32 bits.
This was checked by a static_assert on the size of the PageHeader struct.

This change makes that field size explicit, rather than assuming that
sizeof(int) == sizeof(int32_t).
This commit is contained in:
Dan Adkins 2022-11-02 09:56:26 -07:00
parent e098428ebb
commit f99277f45c

View File

@ -1066,7 +1066,7 @@ private:
}; };
uint64_t seq; // seq is the index of the virtually infinite disk queue file. Its unit is bytes. uint64_t seq; // seq is the index of the virtually infinite disk queue file. Its unit is bytes.
uint64_t popped; uint64_t popped;
int payloadSize; int32_t payloadSize;
}; };
// The on disk format depends on the size of PageHeader. // The on disk format depends on the size of PageHeader.
static_assert(sizeof(PageHeader) == 36, "PageHeader must be 36 bytes"); static_assert(sizeof(PageHeader) == 36, "PageHeader must be 36 bytes");
@ -1703,4 +1703,4 @@ TEST_CASE("performance/fdbserver/DiskQueue") {
queue->dispose(); queue->dispose();
wait(queue->onClosed()); wait(queue->onClosed());
return Void(); return Void();
} }