econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 1 | CREATE TABLE FEEDS ( |
| 2 | FEEDID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 3 | GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
| 4 | NAME VARCHAR(255) NOT NULL, |
| 5 | VERSION VARCHAR(20) NOT NULL, |
| 6 | DESCRIPTION VARCHAR(1000), |
| 7 | BUSINESS_DESCRIPTION VARCHAR(1000) DEFAULT NULL, |
| 8 | AUTH_CLASS VARCHAR(32) NOT NULL, |
| 9 | PUBLISHER VARCHAR(8) NOT NULL, |
| 10 | SELF_LINK VARCHAR(256), |
| 11 | PUBLISH_LINK VARCHAR(256), |
| 12 | SUBSCRIBE_LINK VARCHAR(256), |
| 13 | LOG_LINK VARCHAR(256), |
| 14 | DELETED BOOLEAN DEFAULT FALSE, |
| 15 | LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
| 16 | SUSPENDED BOOLEAN DEFAULT FALSE, |
| 17 | CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
| 18 | ); |
| 19 | |
| 20 | CREATE TABLE FEED_ENDPOINT_IDS ( |
| 21 | FEEDID INT UNSIGNED NOT NULL, |
| 22 | USERID VARCHAR(20) NOT NULL, |
| 23 | PASSWORD VARCHAR(32) NOT NULL |
| 24 | ); |
| 25 | |
| 26 | CREATE TABLE FEED_ENDPOINT_ADDRS ( |
| 27 | FEEDID INT UNSIGNED NOT NULL, |
| 28 | ADDR VARCHAR(44) NOT NULL |
| 29 | ); |
| 30 | |
| 31 | CREATE TABLE SUBSCRIPTIONS ( |
econwar | c503747 | 2019-02-14 09:37:44 +0000 | [diff] [blame] | 32 | SUBID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 33 | FEEDID INT UNSIGNED NOT NULL, |
| 34 | GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
| 35 | DELIVERY_URL VARCHAR(256), |
| 36 | DELIVERY_USER VARCHAR(20), |
| 37 | DELIVERY_PASSWORD VARCHAR(32), |
| 38 | DELIVERY_USE100 BOOLEAN DEFAULT FALSE, |
| 39 | METADATA_ONLY BOOLEAN DEFAULT FALSE, |
| 40 | SUBSCRIBER VARCHAR(8) NOT NULL, |
| 41 | SELF_LINK VARCHAR(256), |
| 42 | LOG_LINK VARCHAR(256), |
| 43 | LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
| 44 | SUSPENDED BOOLEAN DEFAULT FALSE, |
| 45 | PRIVILEGED_SUBSCRIBER BOOLEAN DEFAULT FALSE, |
edepaul | 58553dd | 2019-03-13 11:54:41 +0000 | [diff] [blame] | 46 | DECOMPRESS BOOLEAN DEFAULT FALSE, |
econwar | c503747 | 2019-02-14 09:37:44 +0000 | [diff] [blame] | 47 | CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 48 | |
| 49 | ); |
| 50 | |
| 51 | CREATE TABLE PARAMETERS ( |
| 52 | KEYNAME VARCHAR(32) NOT NULL PRIMARY KEY, |
| 53 | VALUE VARCHAR(4096) NOT NULL |
| 54 | ); |
| 55 | |
| 56 | CREATE TABLE LOG_RECORDS ( |
| 57 | TYPE ENUM('pub', 'del', 'exp', 'pbf', 'dlx') NOT NULL, |
| 58 | EVENT_TIME BIGINT NOT NULL, /* time of the publish request */ |
| 59 | PUBLISH_ID VARCHAR(64) NOT NULL, /* unique ID assigned to this publish attempt */ |
| 60 | FEEDID INT UNSIGNED NOT NULL, /* pointer to feed in FEEDS */ |
| 61 | REQURI VARCHAR(256) NOT NULL, /* request URI */ |
| 62 | METHOD ENUM('DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'TRACE') NOT NULL, /* HTTP method */ |
| 63 | CONTENT_TYPE VARCHAR(256) NOT NULL, /* content type of published file */ |
| 64 | CONTENT_LENGTH BIGINT NOT NULL, /* content length of published file */ |
| 65 | |
| 66 | FEED_FILEID VARCHAR(256), /* file ID of published file */ |
| 67 | REMOTE_ADDR VARCHAR(40), /* IP address of publishing endpoint */ |
| 68 | USER VARCHAR(50), /* user name of publishing endpoint */ |
| 69 | STATUS SMALLINT, /* status code returned to delivering agent */ |
| 70 | |
| 71 | DELIVERY_SUBID INT UNSIGNED, /* pointer to subscription in SUBSCRIPTIONS */ |
| 72 | DELIVERY_FILEID VARCHAR(256), /* file ID of file being delivered */ |
| 73 | RESULT SMALLINT, /* result received from subscribing agent */ |
| 74 | |
| 75 | ATTEMPTS INT, /* deliveries attempted */ |
| 76 | REASON ENUM('notRetryable', 'retriesExhausted', 'diskFull', 'other'), |
| 77 | |
| 78 | RECORD_ID BIGINT UNSIGNED NOT NULL PRIMARY KEY, /* unique ID for this record */ |
| 79 | CONTENT_LENGTH_2 BIGINT, |
EmmettCox | 5da50e9 | 2019-02-05 16:16:40 +0000 | [diff] [blame] | 80 | FILENAME VARCHAR(256), /* Name of the file being published on DR */ |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 81 | |
| 82 | INDEX (FEEDID) USING BTREE, |
| 83 | INDEX (DELIVERY_SUBID) USING BTREE, |
| 84 | INDEX (RECORD_ID) USING BTREE |
| 85 | ) ENGINE = MyISAM; |
| 86 | |
| 87 | CREATE TABLE INGRESS_ROUTES ( |
| 88 | SEQUENCE INT UNSIGNED NOT NULL, |
| 89 | FEEDID INT UNSIGNED NOT NULL, |
| 90 | USERID VARCHAR(20), |
| 91 | SUBNET VARCHAR(44), |
| 92 | NODESET INT UNSIGNED NOT NULL |
| 93 | ); |
| 94 | |
| 95 | CREATE TABLE EGRESS_ROUTES ( |
| 96 | SUBID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 97 | NODEID INT UNSIGNED NOT NULL |
| 98 | ); |
| 99 | |
| 100 | CREATE TABLE NETWORK_ROUTES ( |
| 101 | FROMNODE INT UNSIGNED NOT NULL, |
| 102 | TONODE INT UNSIGNED NOT NULL, |
| 103 | VIANODE INT UNSIGNED NOT NULL |
| 104 | ); |
| 105 | |
| 106 | CREATE TABLE NODESETS ( |
| 107 | SETID INT UNSIGNED NOT NULL, |
| 108 | NODEID INT UNSIGNED NOT NULL |
| 109 | ); |
| 110 | |
| 111 | CREATE TABLE NODES ( |
| 112 | NODEID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 113 | NAME VARCHAR(255) NOT NULL, |
| 114 | ACTIVE BOOLEAN DEFAULT TRUE |
| 115 | ); |
| 116 | |
| 117 | CREATE TABLE GROUPS ( |
| 118 | GROUPID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 119 | AUTHID VARCHAR(100) NOT NULL, |
| 120 | NAME VARCHAR(50) NOT NULL, |
| 121 | DESCRIPTION VARCHAR(255), |
| 122 | CLASSIFICATION VARCHAR(20) NOT NULL, |
| 123 | MEMBERS TINYTEXT, |
| 124 | LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
| 125 | ); |
| 126 | |
| 127 | INSERT INTO PARAMETERS VALUES |
| 128 | ('ACTIVE_POD', 'dmaap-dr-prov'), |
| 129 | ('PROV_ACTIVE_NAME', 'dmaap-dr-prov'), |
| 130 | ('STANDBY_POD', ''), |
| 131 | ('PROV_NAME', 'dmaap-dr-prov'), |
| 132 | ('NODES', 'dmaap-dr-node'), |
| 133 | ('PROV_DOMAIN', ''), |
| 134 | ('DELIVERY_INIT_RETRY_INTERVAL', '10'), |
| 135 | ('DELIVERY_MAX_AGE', '86400'), |
| 136 | ('DELIVERY_MAX_RETRY_INTERVAL', '3600'), |
econwar | c503747 | 2019-02-14 09:37:44 +0000 | [diff] [blame] | 137 | ('DELIVERY_FILE_PROCESS_INTERVAL', '600'), |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 138 | ('DELIVERY_RETRY_RATIO', '2'), |
| 139 | ('LOGROLL_INTERVAL', '300'), |
| 140 | ('PROV_AUTH_ADDRESSES', 'dmaap-dr-prov|dmaap-dr-node'), |
| 141 | ('PROV_AUTH_SUBJECTS', ''), |
| 142 | ('PROV_MAXFEED_COUNT', '10000'), |
| 143 | ('PROV_MAXSUB_COUNT', '100000'), |
| 144 | ('PROV_REQUIRE_CERT', 'false'), |
econwar | d3c00d2 | 2018-08-31 14:48:53 +0000 | [diff] [blame] | 145 | ('PROV_REQUIRE_SECURE', 'true'), |
econwar | c503747 | 2019-02-14 09:37:44 +0000 | [diff] [blame] | 146 | ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE|DELIVERY_FILE_PROCESS_INTERVAL') |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 147 | ; |
| 148 | |
| 149 | INSERT INTO GROUPS(GROUPID, AUTHID, NAME, DESCRIPTION, CLASSIFICATION, MEMBERS) |
| 150 | VALUES (1, 'Basic dXNlcjE6cGFzc3dvcmQx', 'Group1', 'First Group for testing', 'Class1', 'Member1'); |
esobmar | c2d7dbe | 2018-09-03 14:58:01 +0100 | [diff] [blame] | 151 | |
edepaul | 58553dd | 2019-03-13 11:54:41 +0000 | [diff] [blame] | 152 | INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, PRIVILEGED_SUBSCRIBER, DECOMPRESS) |
| 153 | VALUES (1, 1, 'https://172.100.0.5:8080', 'user1', 'password1', true, false, 'user1', false, 1, false, false); |
econwar | 7f93b3d | 2018-09-03 09:24:00 +0000 | [diff] [blame] | 154 | |
esobmar | c2d7dbe | 2018-09-03 14:58:01 +0100 | [diff] [blame] | 155 | INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, SUBSCRIBER, SELF_LINK, LOG_LINK) |
| 156 | VALUES (23, 1, 'http://delivery_url', 'user1', 'somepassword', 'sub123', 'selflink', 'loglink'); |
Emmett Cox | 096e977 | 2018-09-03 11:43:13 +0100 | [diff] [blame] | 157 | |
Emmett Cox | 5cbbe74 | 2018-09-05 10:33:05 +0100 | [diff] [blame] | 158 | INSERT INTO FEED_ENDPOINT_IDS(FEEDID, USERID, PASSWORD) |
| 159 | VALUES (1, 'USER', 'PASSWORD'); |
| 160 | |
EmmettCox | 51f0b1c | 2019-03-22 17:19:56 +0000 | [diff] [blame] | 161 | INSERT INTO FEED_ENDPOINT_ADDRS(FEEDID, ADDR) |
| 162 | VALUES (1, '172.0.0.1'); |
| 163 | |
Emmett Cox | 096e977 | 2018-09-03 11:43:13 +0100 | [diff] [blame] | 164 | INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK) |
| 165 | VALUES (1, 1,'Feed1','v0.1', 'First Feed for testing', 'First Feed for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link'); |
| 166 | |
| 167 | insert into INGRESS_ROUTES(SEQUENCE, FEEDID , USERID, SUBNET, NODESET) |
| 168 | VALUES (1,1,'user',null,2); |
| 169 | |
| 170 | insert into INGRESS_ROUTES(SEQUENCE, FEEDID , USERID, SUBNET, NODESET) |
| 171 | VALUES (2,1,'user',null,2); |
| 172 | |
| 173 | insert into NODESETS(SETID, NODEID) |
esobmar | 8f2e78c | 2018-09-07 16:39:17 +0100 | [diff] [blame] | 174 | VALUES (2,2); |
Emmett Cox | 1d97102 | 2018-09-06 13:58:27 +0100 | [diff] [blame] | 175 | |
EmmettCox | efa3dec | 2019-02-18 12:24:01 +0000 | [diff] [blame] | 176 | insert into LOG_RECORDS(RECORD_ID,TYPE,EVENT_TIME,PUBLISH_ID,FEEDID,REQURI,METHOD,CONTENT_TYPE,CONTENT_LENGTH,FEED_FILEID,REMOTE_ADDR,USER,STATUS,DELIVERY_SUBID,DELIVERY_FILEID,RESULT,ATTEMPTS,REASON,FILENAME) |
| 177 | VALUES(1,'pub',2536159564422,'ID',1,'URL/file123','PUT','application/vnd.dmaap-dr.log-list; version=1.0',100,1,'172.0.0.8','user',204,1,1,204,0,'other','file123'); |
Emmett Cox | 1d97102 | 2018-09-06 13:58:27 +0100 | [diff] [blame] | 178 | |
| 179 | CREATE ALIAS IF NOT EXISTS `SUBSTRING_INDEX` AS $$ |
| 180 | String Function(String one, String two, String three){ |
| 181 | return "url"; |
| 182 | } |
esobmar | 8f2e78c | 2018-09-07 16:39:17 +0100 | [diff] [blame] | 183 | $$; |
| 184 | |
| 185 | insert into NETWORK_ROUTES(FROMNODE, TONODE, VIANODE) |
| 186 | VALUES (1, 3, 2); |
| 187 | |
| 188 | insert into NODES(NODEID, NAME) values |
| 189 | (1, 'stub_from.'), |
| 190 | (2, 'stub_via.'), |
| 191 | (3, 'stub_to.'), |
| 192 | (4, 'node01.'), |
| 193 | (5, 'node02.'), |
| 194 | (6, 'node03.') |
| 195 | ; |
| 196 | insert into EGRESS_ROUTES(SUBID, NODEID) values (1, 1); |
| 197 | |