Created
May 5, 2016 12:11
-
-
Save dw/4656391464195aa5da79066d48fb6d9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lmdb | |
def test(): | |
env = lmdb.open("test.lmdb", max_dbs=1, map_size=15*1024*1024) | |
try: | |
value = bytearray(" "*9*1024*1024) | |
with env.begin(write=True, buffers=True) as txn: | |
txn.put("big", value, dupdata=False, overwrite=True) | |
with env.begin(write=True,) as txn: | |
print txn.delete("big") | |
with env.begin(write=True,) as txn: | |
txn.put('a', 'a') | |
with env.begin(write=True, buffers=True) as txn: | |
txn.put("big", value, dupdata=False, overwrite=True) | |
with env.begin(write=True,) as txn: | |
print txn.delete("big") | |
with env.begin(write=True,) as txn: | |
txn.put('a', 'a') | |
finally: | |
env.sync() | |
env.close() | |
#import pdb;pdb.set_trace() | |
if __name__ == "__main__": | |
test() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment