Skip to content

Instantly share code, notes, and snippets.

@patter001
Last active May 5, 2016 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patter001/f70ba142eb33654fc95d554152a69952 to your computer and use it in GitHub Desktop.
Save patter001/f70ba142eb33654fc95d554152a69952 to your computer and use it in GitHub Desktop.
lmdb size test
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, buffers=True) as txn:
txn.put("big", value, dupdata=False, overwrite=True)
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