summaryrefslogtreecommitdiff
path: root/dist/db.py
blob: 938d36d8d62034f4172def255b9ecbd536537e50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# A simple python script to build a file that can be bulk-loaded into a
# WiredTiger database for smoke-testing.

import getopt, random, sys

dmin = 7        # Minimum data size
dmax = 837      # Maximum data size

seed = None     # Random number seed
pairs = 100000  # Key/data pairs to output

opts, args = getopt.getopt(sys.argv[1:], "m:n:s:")
for o, a in opts:
    if o == "-m":
        dmax = int(a)
    elif o == "-n":
        pairs = int(a)
    elif o == "-s":
        seed = int(a)

random.seed(seed)
for i in range(pairs):
    fmt = "%010d\ndata: %0" + str(random.randrange(dmin, dmax)) + "d"
    print(fmt % (i, i))