Commit graph

194734 commits

Author SHA1 Message Date
Sergei Petrunia
a9c1feea60 Fix statistics_upgrade.test 2022-01-19 18:10:10 +03:00
Sergei Petrunia
9de81b2cde Handle upgrades 2022-01-19 18:10:09 +03:00
Sergei Petrunia
e675f44624 Code cleanup: don't duplicate the position-in-interval code 2022-01-19 18:10:09 +03:00
Sergei Petrunia
899dfb078e Code cleanups part #3 2022-01-19 18:10:09 +03:00
Sergei Petrunia
859c14ff01 Better names: s/histogram_/histogram/, s/Histogram_json/Histogram_json_hb/ 2022-01-19 18:10:09 +03:00
Sergei Petrunia
fc6a4a33b2 Cleanup histogram collection code 2022-01-19 18:10:09 +03:00
Sergei Petrunia
02a67307d3 Fix compiation on windows 2022-01-19 18:10:09 +03:00
Sergei Petrunia
3486bf4110 Code cleanup + reduce the diff size 2022-01-19 18:10:09 +03:00
Sergei Petrunia
229c836d6a Fix valgrind failure 2022-01-19 18:10:09 +03:00
Sergei Petrunia
dde6d76995 Trivial code cleanup 2022-01-19 18:10:09 +03:00
Sergei Petrunia
a93b377863 Fix histogram memory management
There are "local" histograms that are allocated by one thread for
one TABLE object, and "global" that are allocated for TABLE_SHARE.
2022-01-19 18:10:09 +03:00
Sergei Petrunia
032587e2dc Code cleanup part #3 2022-01-19 18:10:09 +03:00
Sergei Petrunia
fcf58a5e0f Code cleanup part#2: do not copy key values in xxx_selectivity() functions 2022-01-19 18:10:09 +03:00
Sergei Petrunia
2a1cdbabec Fix JSON parsing: future-proof data representation in JSON, code cleanup 2022-01-19 18:10:09 +03:00
Sergei Petrunia
a0b4a86822 Code cleanup part #2. 2022-01-19 18:10:09 +03:00
Sergei Petrunia
1496a52d6d Update test results (new histogram type: JSON_HB) 2022-01-19 18:10:09 +03:00
Sergei Petrunia
72c0ba43b2 Code cleanup part #1 2022-01-19 18:10:09 +03:00
Sergei Petrunia
f76e310ace Rename histogram_type=JSON to JSON_HB 2022-01-19 18:10:09 +03:00
Sergei Petrunia
a48e63c5fe Fix compile error and test failure:
- Don't use 'res' uninitialized
- multiply it by col_non_nulls before set_if_bigger(...) call.
2022-01-19 18:10:09 +03:00
Michael Okoko
096995b106 Fix column range cardinality crash when histogram is null
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:09 +03:00
Michael Okoko
058a90e6f5 Use existing statistics test to improve coverage for JSON statistics
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:09 +03:00
Michael Okoko
3692adebd4 Fix avg_frequency statistics and remove stderr dumps
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
bff65a813e Implement point selectivity for JSON histograms
* Also merges tests relating to JSON statistics into one file

Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
547f805311 Refactor histogram point selectivity
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
e10d99ce87 Backfill json histogram bounds during building
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
3d952cd8bd Improve tests and test results to cover larger cases
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
63cbd0748b replace range_selectivity methods for Histograms and add tests
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
c129689ddc Use binary search to compute range selectivity
* it also adds an "explain select" statement to the test so that the fprintf calls
  can print the computed intervals to mysqld.1.err

Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
c605285bb8 fix returned value type for empty json objects
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
69f24c238e Use generic Histogram_base class for Histogram_builders
This fixes the wrong calculation for avg_frequency in json histograms
by replacing the specific histogram objects with the generic Histogram_base class.

It also restores get/set size functions as they were useful in calculating fields
for binary histogram.

Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Sergei Petrunia
21e0f5487f MDEV-21130: Histograms: use JSON as on-disk format
A demo of how to use in-memory data structure for histogram.
The patch shows how to
* convert string form of data to binary form
* compare two values in binary form
* compute a fraction for val in [X, Y] range.

grep for GSOC-TODO for notes.
2022-01-19 18:10:08 +03:00
Michael Okoko
e778d12f83 report parse error when parsing JSON histogram fails
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
fe2e516a50 inform test result of zero hist_size for json histogram
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
bf4d0dcfe2 implement parse and serialize for histogram json 2022-01-19 18:10:08 +03:00
Michael Okoko
9bba595528 remove unneeded shared methods
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
1fa7af749e Split histogram classes and into JSON and binary classes
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Sergei Petrunia
1998b787ac MDEV-21130: Histograms: use JSON as on-disk format
Preparation for handling different kinds of histograms:

- In Column_statistics, change "Histogram histogram" into
  "Histogram *histogram_".  This allows for different kinds
  of Histogram classes with virtual functions.

- [Almost] remove the usage of Histogram->set_values and
  Histogram->set_size. The code outside the histogram should
  not make any assumptions about what/how is stored in the Histogram.

- Introduce drafts of methods to read/save histograms to/from disk.
2022-01-19 18:10:08 +03:00
Michael Okoko
fb2edab3eb Extract json parser functions from class
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
6bc2df5fa4 Add parser to read JSON array (of histograms) into string vector
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
524322ad3e Properly initialize bucket bounds vector
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
d4d539803b Fix garbage null values at end of histogram json
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:08 +03:00
Michael Okoko
a378735862 Fix garbage null values at end of json array elements
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:07 +03:00
Michael Okoko
9954aecc2b Store bucket bounds and extend test cases for JSON histogram
This fixes the memory allocation for json histogram builder and add more column types for testing.
Some challenges at the moment include:
* Garbage value at the end of JSON array still persists.
* Garbage value also gets appended to bucket values if the column is a primary key.
* There's a memory leak resulting in a "Warning: Memory not freed" message at the end of tests.

Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:07 +03:00
Michael Okoko
237447de63 rough base for json histogram builder
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:07 +03:00
Michael Okoko
567552b410 Update test results to match updated system tables
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:07 +03:00
Michael Okoko
2373133f99 record statistics_json test
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:07 +03:00
Michael Okoko
79cdb535da add json statistics test and change histogram column type to blob 2022-01-19 18:10:07 +03:00
Michael Okoko
2aca7b0c33 Prepare JSON as valid histogram_type
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:07 +03:00
Vladislav Vaintroub
e222e44d1b Merge branch 'preview-10.8-MDEV-26713-Windows-i18-support' into 10.8 2022-01-18 21:37:52 +01:00
Vladislav Vaintroub
2e48fbe3f5 MDEV-27525 Invalid (non-UTF8) characters found for option 'plugin_dir'
Two Problems
1. Upgrade wizard failed to retrieve path to service executable,
if it contained non-ASCII.
Fixed by setlocale(LC_ALL, "en_US.UTF8"), which was missing in upgrade wizard

2.mysql_upgrade_service only updated (converted to UTF8) the server's sections
leaving client's as-is

Corrected typo.

3. Fixed assertion in my_getopt, turns out to be too strict.
2022-01-18 17:32:53 +01:00