e2915baca5370bb53d921678fa0c571d9049668f
[phoenix.git] / phoenix-pherf / src / test / resources / scenario / test_scenario.xml
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <!--
3 ~ Licensed to the Apache Software Foundation (ASF) under one
4 ~ or more contributor license agreements. See the NOTICE file
5 ~ distributed with this work for additional information
6 ~ regarding copyright ownership. The ASF licenses this file
7 ~ to you under the Apache License, Version 2.0 (the
8 ~ "License"); you may not use this file except in compliance
9 ~ with the License. You may obtain a copy of the License at
10 ~
11 ~ http://www.apache.org/licenses/LICENSE-2.0
12 ~
13 ~ Unless required by applicable law or agreed to in writing, software
14 ~ distributed under the License is distributed on an "AS IS" BASIS,
15 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 ~ See the License for the specific language governing permissions and
17 ~ limitations under the License.
18 -->
19
20 <datamodel name="test_scenario">
21 <datamapping>
22 <column>
23 <!-- This column type defines what will generally happen to VARCHAR fields unless they are explicitly defined or overridden elsewhere -->
24 <type>VARCHAR</type>
25 <dataSequence>RANDOM</dataSequence>
26 <length>15</length>
27 <name>GENERAL_VARCHAR</name>
28 </column>
29 <column>
30 <type>CHAR</type>
31 <dataSequence>SEQUENTIAL</dataSequence>
32 <length>15</length>
33 <name>GENERAL_CHAR</name>
34 </column>
35 <column>
36 <type>DATE</type>
37 <!--SEQUENTIAL is unsupported for DATE -->
38 <dataSequence>RANDOM</dataSequence>
39 <!-- Number [0-100] that represents the probability of creating a null value -->
40 <!-- The higher the number, the more like the value will returned will be null -->
41 <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
42 <nullChance>0</nullChance>
43 <minValue>1975</minValue>
44 <maxValue>2025</maxValue>
45 <name>GENERAL_DATE</name>
46 </column>
47 <column>
48 <type>DATE</type>
49 <!--SEQUENTIAL is unsupported for DATE -->
50 <dataSequence>RANDOM</dataSequence>
51 <!-- Number [0-100] that represents the probability of creating a null value -->
52 <!-- The higher the number, the more like the value will returned will be null -->
53 <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
54 <nullChance>0</nullChance>
55 <useCurrentDate>true</useCurrentDate>
56 <name>NOW_DATE</name>
57 </column>
58 <column>
59 <type>DECIMAL</type>
60 <dataSequence>RANDOM</dataSequence>
61 <minValue>0</minValue>
62 <maxValue>1</maxValue>
63
64 <!-- Precision is limited to 18 -->
65 <precision>18</precision>
66 <!-- Number [0-100] that represents the probability of creating a null value -->
67 <!-- The higher the number, the more like the value will returned will be null -->
68 <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
69 <nullChance>10</nullChance>
70 <name>GENERAL_DECIMAL</name>
71 </column>
72 <column>
73 <type>INTEGER</type>
74 <dataSequence>RANDOM</dataSequence>
75 <minValue>1</minValue>
76 <maxValue>50000000</maxValue>
77 <!-- Number [0-100] that represents the probability of creating a null value -->
78 <!-- The higher the number, the more like the value will returned will be null -->
79 <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
80 <nullChance>100</nullChance>
81 <name>GENERAL_INTEGER</name>
82 </column>
83 <column>
84 <type>DATE</type>
85 <name>CREATED_DATE</name>
86 <minValue>1975</minValue>
87 <maxValue>2025</maxValue>
88 <valuelist>
89 <!-- Distributes randomly with equal chance of being picked -->
90 <datavalue distribution="80">
91 <!-- Joda time format: yyyy-MM-dd HH:mm:ss.SSS ZZZ -->
92 <minValue>2019-09-15 00:01:00.000</minValue>
93 <maxValue>2019-09-15 11:00:00.000</maxValue>
94 </datavalue>
95 <datavalue distribution="10">
96 <value>2019-09-19 00:01:00.000</value>
97 </datavalue>
98 <datavalue distribution="10">
99 <minValue>2019-09-22 00:01:00.000</minValue>
100 <maxValue>2019-09-22 00:01:00.300</maxValue>
101 </datavalue>
102 </valuelist>
103 </column>
104 <column>
105 <type>DATE</type>
106 <name>PRESENT_DATE</name>
107 <minValue>1975</minValue>
108 <maxValue>2025</maxValue>
109 <valuelist>
110 <!-- Distributes randomly with equal chance of being picked -->
111 <datavalue distribution="80">
112 <!-- Joda time format: yyyy-MM-dd HH:mm:ss.SSS z -->
113 <useCurrentDate>true</useCurrentDate>
114 </datavalue>
115 <datavalue distribution="20">
116 <useCurrentDate>true</useCurrentDate>
117 </datavalue>
118 </valuelist>
119 </column>
120 <column>
121 <type>CHAR</type>
122 <userDefined>true</userDefined>
123 <dataSequence>LIST</dataSequence>
124 <length>15</length>
125 <name>PARENT_ID</name>
126 <valuelist>
127 <!-- Distributes according to specified values. These must total 100 -->
128 <datavalue distribution="60">
129 <value>aAAyYhnNbBs9kWk</value>
130 </datavalue>
131 <datavalue distribution="20">
132 <value>bBByYhnNbBs9kWu</value>
133 </datavalue>
134 <datavalue distribution="20">
135 <value>cCCyYhnNbBs9kWr</value>
136 </datavalue>
137 </valuelist>
138 </column>
139 <column>
140 <!-- This column type defines what will generally happen to VARCHAR fields unless they are explicitly defined or overridden elsewhere -->
141 <type>VARCHAR</type>
142 <length>10</length>
143 <userDefined>true</userDefined>
144 <dataSequence>RANDOM</dataSequence>
145 <name>OLDVAL_STRING</name>
146 <prefix>MYPRFX</prefix>
147 </column>
148 <column>
149 <!-- This column type defines what will generally happen to VARCHAR fields unless they are explicitly defined or overridden elsewhere -->
150 <type>VARCHAR</type>
151 <length>15</length>
152 <userDefined>true</userDefined>
153 <dataSequence>RANDOM</dataSequence>
154 <name>NEWVAL_STRING</name>
155 <prefix>TSTPRFX</prefix>
156 </column>
157 <column>
158 <type>CHAR</type>
159 <length>3</length>
160 <userDefined>true</userDefined>
161 <dataSequence>LIST</dataSequence>
162 <name>IDENTIFIER</name>
163 <valuelist>
164 <!-- Distributes according to specified values. These must total 100 -->
165 <datavalue distribution="60">
166 <value>ABC</value>
167 </datavalue>
168 <datavalue distribution="20">
169 <value>XYZ</value>
170 </datavalue>
171 <datavalue distribution="20">
172 <value>LMN</value>
173 </datavalue>
174 </valuelist>
175 </column>
176 <column>
177 <type>CHAR</type>
178 <userDefined>true</userDefined>
179 <dataSequence>SEQUENTIAL</dataSequence>
180 <length>8</length>
181 <name>OTHER_ID</name>
182 <prefix>z0Oxx00</prefix>
183 </column>
184 </datamapping>
185 <scenarios>
186 <scenario tableName="PHERF.TEST_TABLE" rowCount="100" name="testScenarioRW">
187 <!-- Scenario level rule overrides will be unsupported in V1.
188 You can use the general datamappings in the mean time-->
189 <dataOverride>
190 <column>
191 <type>VARCHAR</type>
192 <userDefined>true</userDefined>
193 <dataSequence>RANDOM</dataSequence>
194 <length>10</length>
195 <name>FIELD</name>
196 </column>
197 </dataOverride>
198
199 <!--
200 This is used to add mixed R/W workloads.
201
202 If this tag exists, a writer pool will be created based on the below properties.
203 These props will override the default values in pherf.properties, but only for this
204 scenario.The write jobs will run in conjunction with the querySet below.
205 -->
206 <writeParams executionDurationInMs="10000">
207 <!--
208 Number of writer it insert into the threadpool
209 -->
210 <writerThreadCount>2</writerThreadCount>
211
212 <!--
213 Time in Ms that each thread will sleep between batch writes. This helps to
214 throttle writers.
215 -->
216 <threadSleepDuration>10</threadSleepDuration>
217
218 <batchSize>1000</batchSize>
219 </writeParams>
220 <querySet concurrency="1" executionType="PARALLEL" executionDurationInMs="10000">
221 <query id="q3" statement="select count(*) from PHERF.TEST_TABLE"/>
222 <query id="q4" statement="select sum(DIVISION) from PHERF.TEST_TABLE"/>
223 </querySet>
224
225 </scenario>
226
227 <scenario tableName="PHERF.TEST_TABLE" rowCount="30" name="testScenario">
228 <!-- Scenario level rule overrides will be unsupported in V1.
229 You can use the general datamappings in the mean time-->
230 <dataOverride>
231 <column>
232 <type>VARCHAR</type>
233 <userDefined>true</userDefined>
234 <dataSequence>RANDOM</dataSequence>
235 <length>10</length>
236 <name>FIELD</name>
237 </column>
238 </dataOverride>
239
240 <!--Note: 1. Minimum of executionDurationInMs or numberOfExecutions. Which ever is reached first
241 2. DDL included in query are executed only once on start of querySet execution.
242 -->
243 <querySet concurrency="1-3" executionType="SERIAL" executionDurationInMs="5000"
244 numberOfExecutions="100">
245 <query id="q1" tenantId="123456789012345" expectedAggregateRowCount="0"
246 statement="select count(*) from PHERF.TEST_TABLE"/>
247 <!-- queryGroup is a way to organize queries across tables or scenario files.
248 The value will be dumped to results. This gives a value to group by on reporting to compare queries -->
249 <query id="q2" queryGroup="g1"
250 statement="select sum(SOME_INT) from PHERF.TEST_TABLE"/>
251 </querySet>
252 <!--Minimum of executionDurationInMs or numberOfExecutions. Which ever is reached first -->
253 <querySet concurrency="2-3" executionType="PARALLEL" executionDurationInMs="10000"
254 numberOfExecutions="10">
255 <query id="q3" statement="select count(*) from PHERF.TEST_TABLE"/>
256 <query id="q4" statement="select sum(SOME_INT) from PHERF.TEST_TABLE"/>
257 </querySet>
258 </scenario>
259
260 <scenario tableName="PHERF.TEST_TABLE" rowCount="99" name="testPreAndPostDdls">
261 <preScenarioDdls>
262 <ddl statement="CREATE INDEX IDX_DIVISION ON ? (DIVISION)" tableName="PHERF.PHERF_PROD_TEST_UNSALTED"/>
263 </preScenarioDdls>
264
265 <postScenarioDdls>
266 <ddl statement="CREATE INDEX IDX_OLDVAL_STRING ON ? (OLDVAL_STRING)" tableName="PHERF.PHERF_PROD_TEST_UNSALTED"/>
267 <ddl statement="CREATE INDEX IDX_CONNECTION_ID ON ? (CONNECTION_ID)" tableName="PHERF.PHERF_PROD_TEST_UNSALTED"/>
268 </postScenarioDdls>
269
270 <querySet concurrency="1" executionType="SERIAL" executionDurationInMs="5000"
271 numberOfExecutions="1">
272 <query id="q1" expectedAggregateRowCount="99" statement="select count(*) from PHERF.TEST_TABLE"/>
273 </querySet>
274 </scenario>
275
276 <!-- To configure a Write Workload to write to a tenant specific view users need to
277 specify the tenantId attribute on the scenario, specifying the tenant they
278 want to write data for as the attribute value. This tells Pherf to take out a
279 tenant-specific connection for executing the write workload.
280 The name of the tenant specific view to write to can then be specified as the value of
281 the tablename attribute. This assumes the tenant specific view has been created. To
282 dynamically create the view see comments below with regard to the ddl attribute.
283 -->
284 <scenario tableName="PHERF.TEST_VIEW" tenantId="xyzdefghijklmno"
285 rowCount="100" name="testMTWriteScenario">
286 <preScenarioDdls>
287 <ddl statement="CREATE VIEW IF NOT EXISTS PHERF.TEST_VIEW (field1 VARCHAR, field2 VARCHAR) AS SELECT * FROM PHERF.TEST_MULTI_TENANT_TABLE" />
288 </preScenarioDdls>
289 </scenario>
290 <!-- Scenario level DDL that is dynamically executed before the Write Workload is run.
291 This pattern is really useful when you want to write data to multi-tenant view and the tenant id is
292 tightly bound to the scenario. In such cases you can't create the view through the data model flow.
293 The value of the tableName attribute is name of the view that is dynamically created based on the DDL
294 in the ddl attribute. Queries accessing the View will need to manually make sure Pherf was run with the -l option at
295 least once.
296 -->
297 <scenario tableName="PHERF.TEST_MT_VIEW" tenantId="abcdefghijklmno"
298 rowCount="100" name="testMTDdlWriteScenario">
299 <preScenarioDdls>
300 <ddl statement="CREATE VIEW IF NOT EXISTS PHERF.TEST_MT_VIEW (field1 VARCHAR) AS SELECT * FROM PHERF.TEST_MULTI_TENANT_TABLE" />
301 </preScenarioDdls>
302 </scenario>
303
304 </scenarios>
305 </datamodel>