mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-22851: Engine independent index statistics are incorrect for large tables on Windows
An oveflow was happening on windows because on Windows sizeof(ulong) is 4 bytes while it is 8 bytes on Linux. Switched avg_frequency and avg length for column statistics to ulonglong. Switched avg_frequency for index statistics to ulonglong.
This commit is contained in:
@ -279,7 +279,9 @@ public:
|
||||
uchar *min_max_record_buffers; /* Record buffers for min/max values */
|
||||
Column_statistics *column_stats; /* Array of statistical data for columns */
|
||||
Index_statistics *index_stats; /* Array of statistical data for indexes */
|
||||
ulong *idx_avg_frequency; /* Array of records per key for index prefixes */
|
||||
|
||||
/* Array of records per key for index prefixes */
|
||||
ulonglong *idx_avg_frequency;
|
||||
uchar *histograms; /* Sequence of histograms */
|
||||
};
|
||||
|
||||
@ -331,7 +333,7 @@ private:
|
||||
CHAR values are stripped of trailing spaces.
|
||||
Flexible values are stripped of their length prefixes.
|
||||
*/
|
||||
ulong avg_length;
|
||||
ulonglong avg_length;
|
||||
|
||||
/*
|
||||
The ratio N/D multiplied by the scale factor Scale_factor_avg_frequency,
|
||||
@ -339,7 +341,7 @@ private:
|
||||
N is the number of rows with not null value in the column,
|
||||
D the number of distinct values among them
|
||||
*/
|
||||
ulong avg_frequency;
|
||||
ulonglong avg_frequency;
|
||||
|
||||
public:
|
||||
|
||||
@ -389,12 +391,12 @@ public:
|
||||
|
||||
void set_avg_length (double val)
|
||||
{
|
||||
avg_length= (ulong) (val * Scale_factor_avg_length);
|
||||
avg_length= (ulonglong) (val * Scale_factor_avg_length);
|
||||
}
|
||||
|
||||
void set_avg_frequency (double val)
|
||||
{
|
||||
avg_frequency= (ulong) (val * Scale_factor_avg_frequency);
|
||||
avg_frequency= (ulonglong) (val * Scale_factor_avg_frequency);
|
||||
}
|
||||
|
||||
bool min_max_values_are_provided()
|
||||
@ -433,11 +435,11 @@ private:
|
||||
in the first k components, and D is the number of distinct
|
||||
k-component prefixes among them
|
||||
*/
|
||||
ulong *avg_frequency;
|
||||
ulonglong *avg_frequency;
|
||||
|
||||
public:
|
||||
|
||||
void init_avg_frequency(ulong *ptr) { avg_frequency= ptr; }
|
||||
void init_avg_frequency(ulonglong *ptr) { avg_frequency= ptr; }
|
||||
|
||||
bool avg_frequency_is_inited() { return avg_frequency != NULL; }
|
||||
|
||||
@ -448,7 +450,7 @@ public:
|
||||
|
||||
void set_avg_frequency(uint i, double val)
|
||||
{
|
||||
avg_frequency[i]= (ulong) (val * Scale_factor_avg_frequency);
|
||||
avg_frequency[i]= (ulonglong) (val * Scale_factor_avg_frequency);
|
||||
}
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user