File size is updated correctly according to 

> fdatasync() is similar to fsync(), but does not flush modified metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled.  For example, changes to  st_atime  or  st_mtime  (respec‐
       tively,  time  of  last  access  and  time  of last modification; see inode(7)) do not require flushing because they are not necessary for a subsequent data read to be handled correctly.  On the other hand, a change to the file size
       (st_size, as made by say ftruncate(2)), would require a metadata flush.

And we don't care about modification times.
Should work alright.
{
                cell.state = Cell::in_memory;
                cell.index = cache_index;
                cell.in_memory_partition_index = current_partition_index;
                index[ssd_cache_key.key] = cell;
                break;
            }
            else
            {
                
                size_t block_index_in_file_before_write = file_buffer.getCurrentBlockIndex();
                if (started_reusing_old_partitions)
                {
                    
                    PaddedPODArray<KeyType> old_keys;
                    file_buffer.readKeys(block_index_in_file_before_write, configuration.write_buffer_blocks_size, old_keys);
                    size_t file_read_end_block_index = block_index_in_file_before_write + configuration.write_buffer_blocks_size;
                    for (auto old_key : old_keys)
                    {
                        auto * it = index.find(old_key);
                        if (it)
                        {
                            const Cell & old_key_cell = it->getMapped();
                            size_t old_key_block = old_key_cell.index.block_index;
                            
                            if (old_key_cell.isOnDisk() &&
                                old_key_block >= block_index_in_file_before_write &&
                                old_key_block < file_read_end_block_index)
                                eraseKeyFromIndex(old_key);
                        }