Ren Z
2016-06-30 13:21:48 UTC
I have few questions regarding WriteBatch:
1) Consider this:
one thread:
using (WriteBatch batch = new WriteBatch())
{
for(int i=0; i<100; i++)
{
batch.Put(i.ToString(), i.ToString())
}
leveld_db.Write(batch);
}
parallel thread:
using (WriteBatch batch = new WriteBatch())
{
for(int i=0; i<100; i++)
{
batch.Put(i.ToString(), (i+1000).ToString())
}
leveld_db.Write(batch);
}
Is there a guarantee that I won't end up with data like {10, 10} {11, 1011}
? (I.e. I expect that only one set or the other stays in db and not mixed,
is this assumption correct?)
2) Somehow related:
If I get to make a lot of changes through a WriteBatch and then write it
all is there a guarantee that another thread won't read in the middle of
writing to disk and end up with some new values and some old (which are
about to be modified) ?
Thanks in advance.
1) Consider this:
one thread:
using (WriteBatch batch = new WriteBatch())
{
for(int i=0; i<100; i++)
{
batch.Put(i.ToString(), i.ToString())
}
leveld_db.Write(batch);
}
parallel thread:
using (WriteBatch batch = new WriteBatch())
{
for(int i=0; i<100; i++)
{
batch.Put(i.ToString(), (i+1000).ToString())
}
leveld_db.Write(batch);
}
Is there a guarantee that I won't end up with data like {10, 10} {11, 1011}
? (I.e. I expect that only one set or the other stays in db and not mixed,
is this assumption correct?)
2) Somehow related:
If I get to make a lot of changes through a WriteBatch and then write it
all is there a guarantee that another thread won't read in the middle of
writing to disk and end up with some new values and some old (which are
about to be modified) ?
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.