1#!/bin/bash
2
3pwprompt=" "
4
5for arg in "$@"; do
6	if [ `expr -- "$arg" : '--tmpdir='` -eq 9 ]; then
7		tmpdir="`echo $arg | awk -F= '{print $2}'`"
8	else
9		echo "ignoring unknown argument: $arg" 1>&2
10	fi
11done
12
13if [[ -f /etc/mysql/debian.cnf ]]; then
14  MDB="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
15else
16  MDB="/usr/bin/mysql"
17fi
18
19# DELETE libcalmysql.so entries first as they are in ha_columnstore.so in 1.4.2 onwards
20$MDB 2> ${tmpdir}/mysql_install.log <<EOD
21DELETE FROM mysql.func WHERE dl='libcalmysql.so';
22DELETE FROM mysql.func WHERE dl='ha_columnstore.so';
23DELETE FROM mysql.func WHERE dl='libregr_mysql.so';
24DELETE FROM mysql.func WHERE dl='libudf_mysql.so';
25INSERT INTO mysql.func VALUES ('calgetstats',0,'ha_columnstore.so','function');
26INSERT INTO mysql.func VALUES ('calsettrace',2,'ha_columnstore.so','function');
27INSERT INTO mysql.func VALUES ('calsetparms',0,'ha_columnstore.so','function');
28INSERT INTO mysql.func VALUES ('calflushcache',2,'ha_columnstore.so','function');
29INSERT INTO mysql.func VALUES ('calgettrace',0,'ha_columnstore.so','function');
30INSERT INTO mysql.func VALUES ('calgetversion',0,'ha_columnstore.so','function');
31INSERT INTO mysql.func VALUES ('calonlinealter',2,'ha_columnstore.so','function');
32INSERT INTO mysql.func VALUES ('calviewtablelock',0,'ha_columnstore.so','function');
33INSERT INTO mysql.func VALUES ('calcleartablelock',0,'ha_columnstore.so','function');
34INSERT INTO mysql.func VALUES ('callastinsertid',2,'ha_columnstore.so','function');
35INSERT INTO mysql.func VALUES ('calgetsqlcount',0,'ha_columnstore.so','function');
36INSERT INTO mysql.func VALUES ('idbpm',2,'ha_columnstore.so','function');
37INSERT INTO mysql.func VALUES ('idbdbroot',2,'ha_columnstore.so','function');
38INSERT INTO mysql.func VALUES ('idbsegment',2,'ha_columnstore.so','function');
39INSERT INTO mysql.func VALUES ('idbsegmentdir',2,'ha_columnstore.so','function');
40INSERT INTO mysql.func VALUES ('idbextentrelativerid',2,'ha_columnstore.so','function');
41INSERT INTO mysql.func VALUES ('idbblockid',2,'ha_columnstore.so','function');
42INSERT INTO mysql.func VALUES ('idbextentid',2,'ha_columnstore.so','function');
43INSERT INTO mysql.func VALUES ('idbextentmin',0,'ha_columnstore.so','function');
44INSERT INTO mysql.func VALUES ('idbextentmax',0,'ha_columnstore.so','function');
45INSERT INTO mysql.func VALUES ('idbpartition',0,'ha_columnstore.so','function');
46INSERT INTO mysql.func VALUES ('idblocalpm',2,'ha_columnstore.so','function');
47INSERT INTO mysql.func VALUES ('mcssystemready',2,'ha_columnstore.so','function');
48INSERT INTO mysql.func VALUES ('mcssystemreadonly',2,'ha_columnstore.so','function');
49INSERT INTO mysql.func VALUES ('mcssystemprimary',2,'ha_columnstore.so','function');
50INSERT INTO mysql.func VALUES ('regr_avgx',1,'libregr_mysql.so','aggregate');
51INSERT INTO mysql.func VALUES ('regr_avgy',1,'libregr_mysql.so','aggregate');
52INSERT INTO mysql.func VALUES ('regr_count',2,'libregr_mysql.so','aggregate');
53INSERT INTO mysql.func VALUES ('regr_slope',1,'libregr_mysql.so','aggregate');
54INSERT INTO mysql.func VALUES ('regr_intercept',1,'libregr_mysql.so','aggregate');
55INSERT INTO mysql.func VALUES ('regr_r2',1,'libregr_mysql.so','aggregate');
56INSERT INTO mysql.func VALUES ('corr',1,'libregr_mysql.so','aggregate');
57INSERT INTO mysql.func VALUES ('regr_sxx',1,'libregr_mysql.so','aggregate');
58INSERT INTO mysql.func VALUES ('regr_syy',1,'libregr_mysql.so','aggregate');
59INSERT INTO mysql.func VALUES ('regr_sxy',1,'libregr_mysql.so','aggregate');
60INSERT INTO mysql.func VALUES ('covar_pop',1,'libregr_mysql.so','aggregate');
61INSERT INTO mysql.func VALUES ('covar_samp',1,'libregr_mysql.so','aggregate');
62INSERT INTO mysql.func VALUES ('distinct_count',2,'libudf_mysql.so','aggregate');
63INSERT INTO mysql.func VALUES ('caldisablepartitions',0,'ha_columnstore.so','function');
64INSERT INTO mysql.func VALUES ('calenablepartitions',0,'ha_columnstore.so','function');
65INSERT INTO mysql.func VALUES ('caldroppartitions',0,'ha_columnstore.so','function');
66INSERT INTO mysql.func VALUES ('calshowpartitions',0,'ha_columnstore.so','function');
67INSERT INTO mysql.func VALUES ('caldroppartitionsbyvalue',0,'ha_columnstore.so','function');
68INSERT INTO mysql.func VALUES ('caldisablepartitionsbyvalue',0,'ha_columnstore.so','function');
69INSERT INTO mysql.func VALUES ('calenablepartitionsbyvalue',0,'ha_columnstore.so','function');
70INSERT INTO mysql.func VALUES ('calshowpartitionsbyvalue',0,'ha_columnstore.so','function');
71INSERT INTO mysql.func VALUES ('moda',4,'libregr_mysql.so','aggregate');
72
73CREATE DATABASE IF NOT EXISTS infinidb_querystats;
74CREATE TABLE IF NOT EXISTS infinidb_querystats.querystats
75(
76  queryID bigint NOT NULL AUTO_INCREMENT,
77  sessionID bigint DEFAULT NULL,
78  host varchar(50),
79  user varchar(50),
80  priority char(20),
81  queryType char(25),
82  query varchar(8000),
83  startTime timestamp NOT NULL,
84  endTime timestamp NOT NULL,
85  \`rows\` bigint,
86  errno int,
87  phyIO bigint,
88  cacheIO bigint,
89  blocksTouched bigint,
90  CPBlocksSkipped bigint,
91  msgInUM bigint,
92  msgOutUm bigint,
93  maxMemPct int,
94  blocksChanged bigint,
95  numTempFiles bigint,
96  tempFileSpace bigint,
97  PRIMARY KEY (queryID)
98);
99
100CREATE TABLE IF NOT EXISTS infinidb_querystats.user_priority
101(
102  host varchar(50),
103  user varchar(50),
104  priority char(20)
105) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
106
107CREATE TABLE IF NOT EXISTS infinidb_querystats.priority
108(
109  priority char(20) primary key,
110  priority_level int
111) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
112
113insert ignore into infinidb_querystats.priority values ('High', 100),('Medium', 66), ('Low', 33);
114EOD
115
116$MDB <@ENGINE_SUPPORTDIR@/syscatalog_mysql.sql 2>/dev/null
117$MDB <@ENGINE_SUPPORTDIR@/calsetuserpriority.sql 2>/dev/null
118$MDB <@ENGINE_SUPPORTDIR@/calremoveuserpriority.sql 2>/dev/null
119$MDB <@ENGINE_SUPPORTDIR@/calshowprocesslist.sql 2>/dev/null
120$MDB <@ENGINE_SUPPORTDIR@/columnstore_info.sql 2>/dev/null
121
122
123