Hello, all and foundationdb developers.
I’m trying to compile foundationdb 7.1.29 from sources with the clang 15 compiler and I receive the following error:
/home/oleg/git/xdb/FoundationDb/fdbserver/KeyValueStoreRocksDB.actor.cpp:272:34: error: assigning to 'rocksdb::Temperature' from incompatible type 'uint8_t' (aka 'unsigned char')
liveFileMetaData.temperature = static_cast<uint8_t>(fileMetaData.temperature);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The reason is that rocksdb::Temperature
is not uint8_t, but it is an enum class based on uint8_t. New versions of clang compiler prohibit conversion from a base type to enum by default.
Because both fileMetaData.temperature
and liveFileMetaData.temperature
have the same type rocksdb::Temperature
, the intermediate casting to uint8_t is not required, and eliminating it solves the compilation problem.
A short patch is here.
diff --git a/fdbserver/KeyValueStoreRocksDB.actor.cpp b/fdbserver/KeyValueStoreRocksDB.actor.cpp
index 6da346742..83f7697bf 100644
--- a/fdbserver/KeyValueStoreRocksDB.actor.cpp
+++ b/fdbserver/KeyValueStoreRocksDB.actor.cpp
@@ -269,7 +269,7 @@ void populateMetaData(CheckpointMetaData* checkpoint, const rocksdb::ExportImpor
liveFileMetaData.being_compacted = fileMetaData.being_compacted;
liveFileMetaData.num_entries = fileMetaData.num_entries;
liveFileMetaData.num_deletions = fileMetaData.num_deletions;
- liveFileMetaData.temperature = static_cast<uint8_t>(fileMetaData.temperature);
+ liveFileMetaData.temperature = fileMetaData.temperature;
liveFileMetaData.oldest_blob_file_number = fileMetaData.oldest_blob_file_number;
liveFileMetaData.oldest_ancester_time = fileMetaData.oldest_ancester_time;
liveFileMetaData.file_creation_time = fileMetaData.file_creation_time;