couchbaselabs/couchstore — Issue #7: Wrote out 61M items, could only read back 34M
Author: dustin
Created: 2012-03-06 10:08:45+00:00
State: open

Using the following scripts:

To populate the data:

```lua
local db = couch.open("/tmp/test.couch", true)

local alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

local large_enough = 4096
local largestring = ""
while #largestring < large_enough do
local i = math.random(1, #alphabet)
largestring = largestring .. string.sub(alphabet, i, i, 1)
end

local start = os.time()
for i = 0, 60, 1
do
print("Doing " .. i)
local t = {}
local k = "k." .. i .. "."
local v = "value" .. i .. " - "
for j = 0, 1000000, 1
do
table.insert(t, {k .. j, v .. j, 1})
end
db:save_bulk(t)
local e1 = os.time()
db:commit()
local e2 = os.time()
print(string.format("Completed in in %d seconds (commit took %d)",
os.difftime(e2, start), os.difftime(e2, e1)))
start = e2
end
```

...and to read back

```lua
local db = couch.open("/tmp/test.couch")

local count = 0
db:changes(0, function(x) count = count + 1 end)
print("Got " .. count .. " items")
```