Skip to content

Commit 33621ea

Browse files
lukechevergreen
authored andcommitted
Import wiredtiger: 956384325e5ff99567ea7b63b1b87b7bb62c76b8 from branch mongodb-4.4
ref: 7dfd939186..956384325e for: 4.3.1 WT-4831 Add option to python tests to not fail if stdout is not empty WT-4935 Add a perf test to find out the wiredtiger_calc_modify overhead WT-5062 Adjust the record size to consume less size WT-5063 Return proper error message for cursor modify operation for not supported cursor types
1 parent 60d8961 commit 33621ea

File tree

15 files changed

+413
-142
lines changed

15 files changed

+413
-142
lines changed

src/third_party/wiredtiger/bench/wtperf/config.c

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,33 @@ config_threads(WTPERF *wtperf, const char *config, size_t len)
220220
goto err;
221221
continue;
222222
}
223+
if (STRING_MATCH("modify", k.str, k.len)) {
224+
if ((workp->modify = v.val) < 0)
225+
goto err;
226+
continue;
227+
}
228+
if (STRING_MATCH("modify_delta", k.str, k.len)) {
229+
if (v.type == WT_CONFIG_ITEM_ID || v.type == WT_CONFIG_ITEM_STRING) {
230+
if (strncmp(v.str, "rand", 4) != 0)
231+
goto err;
232+
/* Special random value */
233+
workp->modify_delta = INT64_MAX;
234+
F_SET(wtperf, CFG_GROW);
235+
} else {
236+
workp->modify_delta = v.val;
237+
if (v.val > 0)
238+
F_SET(wtperf, CFG_GROW);
239+
if (v.val < 0)
240+
F_SET(wtperf, CFG_SHRINK);
241+
}
242+
continue;
243+
}
244+
if (STRING_MATCH("modify_force_update", k.str, k.len)) {
245+
if (v.type != WT_CONFIG_ITEM_BOOL)
246+
goto err;
247+
workp->modify_force_update = v.val;
248+
continue;
249+
}
223250
if (STRING_MATCH("ops_per_txn", k.str, k.len)) {
224251
if ((workp->ops_per_txn = v.val) < 0)
225252
goto err;
@@ -302,7 +329,8 @@ config_threads(WTPERF *wtperf, const char *config, size_t len)
302329
scan = NULL;
303330
if (ret != 0)
304331
goto err;
305-
if (workp->insert == 0 && workp->read == 0 && workp->update == 0 && workp->truncate == 0)
332+
if (workp->insert == 0 && workp->modify == 0 && workp->read == 0 && workp->truncate == 0 &&
333+
workp->update == 0)
306334
goto err;
307335
/* Why run with truncate if we don't want any truncation. */
308336
if (workp->truncate != 0 && workp->truncate_pct == 0 && workp->truncate_count == 0)
@@ -312,7 +340,8 @@ config_threads(WTPERF *wtperf, const char *config, size_t len)
312340
/* Truncate should have its own exclusive thread. */
313341
if (workp->truncate != 0 && workp->threads > 1)
314342
goto err;
315-
if (workp->truncate != 0 && (workp->insert > 0 || workp->read > 0 || workp->update > 0))
343+
if (workp->truncate != 0 &&
344+
(workp->insert > 0 || workp->modify > 0 || workp->read > 0 || workp->update > 0))
316345
goto err;
317346
wtperf->workers_cnt += (u_int)workp->threads;
318347
}
@@ -765,11 +794,11 @@ config_sanity(WTPERF *wtperf)
765794

766795
if (wtperf->workload != NULL)
767796
for (i = 0, workp = wtperf->workload; i < wtperf->workload_cnt; ++i, ++workp) {
768-
if (opts->readonly &&
769-
(workp->insert != 0 || workp->update != 0 || workp->truncate != 0)) {
797+
if (opts->readonly && (workp->insert != 0 || workp->modify != 0 ||
798+
workp->truncate != 0 || workp->update != 0)) {
770799
fprintf(stderr,
771-
"Invalid workload: insert, update or "
772-
"truncate specified with readonly\n");
800+
"Invalid workload: insert, modify, truncate or update specified with "
801+
"readonly\n");
773802
return (EINVAL);
774803
}
775804
if (workp->insert != 0 && workp->table_index != INT32_MAX) {
@@ -785,6 +814,12 @@ config_sanity(WTPERF *wtperf)
785814
workp->table_index, opts->table_count);
786815
return (EINVAL);
787816
}
817+
if (workp->modify != 0 && workp->ops_per_txn == 0) {
818+
fprintf(stderr,
819+
"Modify operations must be executed with explicit transaction, specify "
820+
"ops_per_txn.");
821+
return (EINVAL);
822+
}
788823
}
789824
return (0);
790825
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# wtperf options file: btree with updates. The goal here is to have a workload of
2+
# large documents that uses a lot of transaction IDs for modify with forced update
3+
# to ensure that update operation happened instead of modify.
4+
conn_config="cache_size=20G"
5+
sess_config="isolation=snapshot"
6+
table_config="type=file"
7+
key_sz=40
8+
value_sz=10000
9+
icount=500000
10+
report_interval=5
11+
random_value=true
12+
run_time=120
13+
populate_threads=1
14+
threads=((count=4,modify=1,ops_per_txn=1,modify_force_update=true))
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# wtperf options file: btree with updates. The goal here is to have a workload
2+
# of large documents that uses a lot of transaction IDs for modify operations
3+
conn_config="cache_size=20G"
4+
sess_config="isolation=snapshot"
5+
table_config="type=file"
6+
key_sz=40
7+
value_sz=10000
8+
icount=500000
9+
report_interval=5
10+
random_value=true
11+
run_time=120
12+
populate_threads=1
13+
threads=((count=4,modify=1,ops_per_txn=1))

src/third_party/wiredtiger/bench/wtperf/runners/wtperf_run.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ rm -f $outfile
3939
echo "Parsed $# args: test: $wttest runmax: $runmax args: $wtarg" >> $outfile
4040

4141
# Each of these has an entry for each op in ops below.
42-
avg=(0 0 0 0)
43-
max=(0 0 0 0)
44-
min=(0 0 0 0)
45-
sum=(0 0 0 0)
42+
avg=(0 0 0 0 0)
43+
max=(0 0 0 0 0)
44+
min=(0 0 0 0 0)
45+
sum=(0 0 0 0 0)
4646
# Load needs floating point and bc, handle separately.
47-
loadindex=5
47+
loadindex=6
4848
avg[$loadindex]=0
4949
max[$loadindex]=0
5050
min[$loadindex]=0
5151
sum[$loadindex]=0
52-
ops=(read insert update truncate)
53-
outp=("Read count:" "Insert count:" "Update count:" "Truncate count:")
52+
ops=(insert modify read truncate update)
53+
outp=("Insert count:" "Modify count:" "Read count:" "Truncate count:" "Update count:" )
5454
outp[$loadindex]="Load time:"
5555

5656
# getval min/max val cur

src/third_party/wiredtiger/bench/wtperf/track.c

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ sum_insert_ops(WTPERF *wtperf)
118118
return (sum_ops(wtperf, offsetof(WTPERF_THREAD, insert)));
119119
}
120120
uint64_t
121+
sum_modify_ops(WTPERF *wtperf)
122+
{
123+
return (sum_ops(wtperf, offsetof(WTPERF_THREAD, modify)));
124+
}
125+
uint64_t
121126
sum_read_ops(WTPERF *wtperf)
122127
{
123128
return (sum_ops(wtperf, offsetof(WTPERF_THREAD, read)));
@@ -185,11 +190,11 @@ latency_op(WTPERF *wtperf, size_t field_offset, uint32_t *avgp, uint32_t *minp,
185190
}
186191
}
187192
void
188-
latency_read(WTPERF *wtperf, uint32_t *avgp, uint32_t *minp, uint32_t *maxp)
193+
latency_insert(WTPERF *wtperf, uint32_t *avgp, uint32_t *minp, uint32_t *maxp)
189194
{
190195
static uint32_t last_avg = 0, last_max = 0, last_min = 0;
191196

192-
latency_op(wtperf, offsetof(WTPERF_THREAD, read), avgp, minp, maxp);
197+
latency_op(wtperf, offsetof(WTPERF_THREAD, insert), avgp, minp, maxp);
193198

194199
/*
195200
* If nothing happened, graph the average, minimum and maximum as they were the last time, it
@@ -206,11 +211,32 @@ latency_read(WTPERF *wtperf, uint32_t *avgp, uint32_t *minp, uint32_t *maxp)
206211
}
207212
}
208213
void
209-
latency_insert(WTPERF *wtperf, uint32_t *avgp, uint32_t *minp, uint32_t *maxp)
214+
latency_modify(WTPERF *wtperf, uint32_t *avgp, uint32_t *minp, uint32_t *maxp)
210215
{
211216
static uint32_t last_avg = 0, last_max = 0, last_min = 0;
212217

213-
latency_op(wtperf, offsetof(WTPERF_THREAD, insert), avgp, minp, maxp);
218+
latency_op(wtperf, offsetof(WTPERF_THREAD, modify), avgp, minp, maxp);
219+
220+
/*
221+
* If nothing happened, graph the average, minimum and maximum as they were the last time, it
222+
* keeps the graphs from having discontinuities.
223+
*/
224+
if (*minp == 0) {
225+
*avgp = last_avg;
226+
*minp = last_min;
227+
*maxp = last_max;
228+
} else {
229+
last_avg = *avgp;
230+
last_min = *minp;
231+
last_max = *maxp;
232+
}
233+
}
234+
void
235+
latency_read(WTPERF *wtperf, uint32_t *avgp, uint32_t *minp, uint32_t *maxp)
236+
{
237+
static uint32_t last_avg = 0, last_max = 0, last_min = 0;
238+
239+
latency_op(wtperf, offsetof(WTPERF_THREAD, read), avgp, minp, maxp);
214240

215241
/*
216242
* If nothing happened, graph the average, minimum and maximum as they were the last time, it
@@ -286,6 +312,11 @@ sum_insert_latency(WTPERF *wtperf, TRACK *total)
286312
sum_latency(wtperf, offsetof(WTPERF_THREAD, insert), total);
287313
}
288314
static void
315+
sum_modify_latency(WTPERF *wtperf, TRACK *total)
316+
{
317+
sum_latency(wtperf, offsetof(WTPERF_THREAD, modify), total);
318+
}
319+
static void
289320
sum_read_latency(WTPERF *wtperf, TRACK *total)
290321
{
291322
sum_latency(wtperf, offsetof(WTPERF_THREAD, read), total);
@@ -344,6 +375,8 @@ latency_print(WTPERF *wtperf)
344375

345376
sum_insert_latency(wtperf, &total);
346377
latency_print_single(wtperf, &total, "insert");
378+
sum_modify_latency(wtperf, &total);
379+
latency_print_single(wtperf, &total, "modify");
347380
sum_read_latency(wtperf, &total);
348381
latency_print_single(wtperf, &total, "read");
349382
sum_update_latency(wtperf, &total);

0 commit comments

Comments
 (0)