File: dd_schema_dd_properties.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (77 lines) | stat: -rw-r--r-- 2,321 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#
# Extract the contents of mysql.dd_propeties and format it in a
# human readable way. This contains various DD related information,
# such as version numbers (removed in the test output to be
# version agnostic), DD table definitions (to be used for opening
# DD tables during upgrade), and SE private data for the DD tables
# (to be used when DD tables are opened on server restart).
#
# Expects the variable $file to be set to indicate the output
# destination. Optionally accepts a filter to be applied.
#

--source include/have_debug.inc

if (!$file)
{
  die;
}

# Get hold of the unformatted dd properties.
set debug='+d,skip_dd_table_access_check';
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval SELECT * FROM mysql.dd_properties INTO OUTFILE '$file';
set debug='-d,skip_dd_table_access_check';

# Provide variables that we can use in the perl snippets.
--let ENV_FILTER = $filter
--let ENV_FILE = $file

# Break up the contents in pieces that are easier to read. Must
# be done in a couple of passes since we insert newlines. Also
# note that we must use -i.bak to allow inplace editing on win.
exec perl -p -i.bak -e
   "s/;/\n/g; s/\\\\*//g;
    s/SYSTEM_TABLES\=/SYSTEM_TABLES\=\n/g;
    s/\=col0/\=\n  col0/g;
    s/\=fields/\=\n    fields/g;
    s/\=elem0/\=\n      elem0/g"
  $file;

--remove_file $file.bak

exec perl -p -i.bak -e
   "s/^elem/      elem/g;
    s/^col/  col/g; s/^data/  data/g; s/^version/  version/g;
    s/^def/  def/g; s/^indexes/    indexes/g;
    s/^foreign_keys/    foreign_keys/g; s/^name/    name/g;
    s/^options/    options/g; s/^id/  id/g;
    s/^lbl/            lbl/g; s/^pos/            pos/g;
    s/^idx/  idx/g; s/^space_id/       space_id/g;
    s/^root/       root/g; s/^table_id/       table_id/g;
    s/^trx_id/       trx_id/g"
  $file;

--remove_file $file.bak

# Remove empty lines, and apply an optional filter to remove lines
# from the contents.
perl;
  use strict;
  use warnings;

  my $file = $ENV{'ENV_FILE'} or die;
  my $filter = $ENV{'ENV_FILTER'};

  open my $fh, '<', $file or die "unable to open file '$file' : $!";
  my @all_lines = grep(/./, <$fh>);
  close $fh;

  if (length $filter) {
    @all_lines = grep(!/$filter/, @all_lines);
  }

  open $fh, '>', $file or die "unable to open file '$file' : $!";
  print $fh @all_lines;
  close $fh;
EOF