• Marko Mäkelä's avatar
    MDEV-11679 Remove redundant function fsp_header_get_crypt_offset() · f2fe6510
    Marko Mäkelä authored
    fsp_header_get_crypt_offset(): Remove.
    
    xdes_arr_size(): Remove.
    
    fsp_header_get_encryption_offset(): Make this an inline function.
    
    The correctness of this change was ensured with the following patch
    that ensures that the two functions returned the same value, only
    differing by FSP_HEADER_OFFSET (38 bytes):
    
    diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
    index f2a4c6bf218..e96c788b7df 100644
    --- a/storage/innobase/fsp/fsp0fsp.cc
    +++ b/storage/innobase/fsp/fsp0fsp.cc
    @@ -850,6 +850,7 @@ fsp_parse_init_file_page(
     	return(ptr);
     }
    
    +static ulint fsp_header_get_encryption_offset(const page_size_t&);
     /**********************************************************************//**
     Initializes the fsp system. */
     void
    @@ -868,6 +869,31 @@ fsp_init(void)
     #endif
    
     	/* Does nothing at the moment */
    +
    +	for (ulint sz = 4096; sz <= 65536; sz *= 2) {
    +		ulint m;
    +		if (sz <= 16384) {
    +			for (ulint ph = 1024; ph <= sz; ph *= 2) {
    +				const page_size_t ps(ph, sz, true);
    +				ulint maria = fsp_header_get_crypt_offset(ps, &m),
    +					oracle = fsp_header_get_encryption_offset(ps);
    +				if (maria != oracle + 38) {
    +					ib::error() << "zip size mismatch: "
    +						    << maria << "!=" << oracle
    +						    << "(" << ph <<","<<sz<<")"
    +						    << m;
    +				}
    +			}
    +		}
    +		const page_size_t p(sz, sz, false);
    +		ulint maria = fsp_header_get_crypt_offset(p, &m),
    +			oracle = fsp_header_get_encryption_offset(p);
    +		if (maria != oracle + 38) {
    +			ib::error() << "size mismatch: "
    +				    << maria << "!=" << oracle
    +				    << "(" <<sz<<")" << m;
    +		}
    +	}
     }
    
     /**********************************************************************//**
    f2fe6510
fil0fil.cc 208 KB