Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oen advice about snapshot #176

Closed
cmumford opened this issue Sep 9, 2014 · 1 comment
Closed

oen advice about snapshot #176

cmumford opened this issue Sep 9, 2014 · 1 comment
Assignees

Comments

@cmumford
Copy link
Contributor

cmumford commented Sep 9, 2014

Original issue 170 created by wangtengchao on 2013-05-15T11:37:30.000Z:

What steps will reproduce the problem?
1.all code adn information showed in the additional information
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
leveldb 1.9 fedora17

Please provide any additional information below.

    const leveldb::Snapshot* snap_shot = db->GetSnapshot();
    leveldb::ReadOptions read_options;
    // change "key0"'s value from "value0" to "new"
    db->Put(leveldb::WriteOptions(),"key0","new");
    string val;
    db->Get(read_options,"key0",&val);
    cout<<"no snapshot value: "<<val<<endl;//output " new" . 
    read_options.snapshot = snap_shot;
    db->Get(read_options,"key0",&val);
    cout<<"snapshot value: "<<val<<endl;//output "value0" . 

    // release snapshot
    db->ReleaseSnapshot(read_options.snapshot);

    db->Get(read_options,"key0",&val);
    cout<<"after release snapshot: "<<val<<endl;
    //output "value0" !!! It's wrong

Advice:
If i release the snapshot ,i should get the newest infomation.
But only i add the "read_options.snapshot = NULL; " after db->ReleaseSnapshot(...) anually,can i get the right result---output "new".

I deep into the code in db_imp.cc and know it will judge "options.snapshot!=NULL" when call NewIterator(...) and Get(...) .
SO I think set the read_options.snapshot=NULL in DB::ReleaseSnapshot() is a good idea. Or you should modify the document clearly and add "read_options.snapshot = NULL;" to the example in the Snapshots part of http://leveldb.googlecode.com/svn/trunk/doc/index.html

@cmumford cmumford self-assigned this Sep 9, 2014
@cmumford
Copy link
Contributor Author

Several year old question. I'm assuming either answered or no longer needed.

maochongxin pushed a commit to maochongxin/leveldb that referenced this issue Jul 21, 2022
Add aarch64 support to src/cycleclock.h.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant