mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-22641: Provide SIMD optimized wrapper for zlib crc32() (#1558)
Existing implementation used my_checksum (from mysys) for calculating table checksum and binlog checksum. This implementation was optimized for powerpc only and lacked SIMD implementation for x86 (using clmul) and ARM (using ACLE) instead used zlib-crc32. mariabackup had its own copy of the crc32 implementation using hardware optimized implementation only for x86 and lagged hardware based implementation for powerpc and ARM. Patch helps unifies all such calls and help aggregate all of them using an unified interface my_checksum(). Said unification also enables hardware optimized calls for all architecture viz. x86, ARM, POWERPC. Default always fallback to zlib crc32. Thanks to Daniel Black for reviewing, fixing and testing PowerPC changes. Thanks to Marko and Daniel for early code feedback.
This commit is contained in:
@@ -1432,9 +1432,10 @@ uint Rdb_key_def::pack_record(const TABLE *const tbl, uchar *const pack_buffer,
|
||||
// ha_rocksdb::convert_record_to_storage_format
|
||||
//
|
||||
if (should_store_row_debug_checksums) {
|
||||
const uint32_t key_crc32 = crc32(0, packed_tuple, tuple - packed_tuple);
|
||||
const uint32_t key_crc32 =
|
||||
my_checksum(0, packed_tuple, tuple - packed_tuple);
|
||||
const uint32_t val_crc32 =
|
||||
crc32(0, unpack_info->ptr(), unpack_info->get_current_pos());
|
||||
my_checksum(0, unpack_info->ptr(), unpack_info->get_current_pos());
|
||||
|
||||
unpack_info->write_uint8(RDB_CHECKSUM_DATA_TAG);
|
||||
unpack_info->write_uint32(key_crc32);
|
||||
@@ -1690,9 +1691,9 @@ int Rdb_key_def::unpack_record(TABLE *const table, uchar *const buf,
|
||||
(const uchar *)unp_reader.read(RDB_CHECKSUM_SIZE));
|
||||
|
||||
const uint32_t computed_key_chksum =
|
||||
crc32(0, (const uchar *)packed_key->data(), packed_key->size());
|
||||
my_checksum(0, packed_key->data(), packed_key->size());
|
||||
const uint32_t computed_val_chksum =
|
||||
crc32(0, (const uchar *)unpack_info->data(),
|
||||
my_checksum(0, unpack_info->data(),
|
||||
unpack_info->size() - RDB_CHECKSUM_CHUNK_SIZE);
|
||||
|
||||
DBUG_EXECUTE_IF("myrocks_simulate_bad_key_checksum1",
|
||||
|
Reference in New Issue
Block a user