Issue 8710 - mdb_copy wait for writer to complete
Summary: mdb_copy wait for writer to complete
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-11 21:25 UTC by muthukumardce@gmail.com
Modified: 2017-09-06 20:26 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description muthukumardce@gmail.com 2017-08-11 21:25:09 UTC
Full_Name: Muthukumar
Version: LMDB 0.82
OS: OSX
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (49.207.184.177)


# Writer

```
import lmdb

db_path = "test.db"
DB_MAX_SIZE = 40 * 1000 * 1000 * 1000
env = lmdb.Environment(db_path, DB_MAX_SIZE, sync=True)
txn = env.begin(write=True, buffers=True)
for i in xrange(5000000):
    value = "*" * 100
    txn.put("i="+str(i), value)
txn.commit()
```

I ran the above python program in my machine which took almost 8 secs to
complete. Simultaneously i try to copy the database using mdb_copy, but it
started copying only after the write program completes its execution.

Please note: First i run the writer program then the mdb_copy, if i start
mdb_copy first it runs smoothly.

Please help. 
Comment 1 Howard Chu 2017-08-12 02:04:21 UTC
muthukumardce@gmail.com wrote:
> Full_Name: Muthukumar
> Version: LMDB 0.82
> OS: OSX
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (49.207.184.177)
> 
> 
> # Writer
> 
> ```
> import lmdb
> 
> db_path = "test.db"
> DB_MAX_SIZE = 40 * 1000 * 1000 * 1000
> env = lmdb.Environment(db_path, DB_MAX_SIZE, sync=True)
> txn = env.begin(write=True, buffers=True)
> for i in xrange(5000000):
>      value = "*" * 100
>      txn.put("i="+str(i), value)
> txn.commit()
> ```
> 
> I ran the above python program in my machine which took almost 8 secs to
> complete. Simultaneously i try to copy the database using mdb_copy, but it
> started copying only after the write program completes its execution.
> 
> Please note: First i run the writer program then the mdb_copy, if i start
> mdb_copy first it runs smoothly.
> 
> Please help.

The ITS is for bug reports, not help requests. Use the openldap-technical 
mailing list for assistance.

The mdb_copy program needs to acquire the DB write mutex before executing, to 
ensure it gets a consistent snapshot. It obviously can't do that until any 
other active writer finishes.

Closing this ITS.
-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 2 Howard Chu 2017-09-06 20:26:50 UTC
changed state Open to Closed