Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
yapple committed Jul 5, 2022
1 parent 591fedf commit b90db8c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,8 @@ rocksdbjavastaticreleasedocker: rocksdbjavastatic rocksdbjavastaticdockerx86_64

fterark:rocksdbjavastatic
cd java;jar -cf target/$(ROCKSDB_JAR_ALL) HISTORY*.md
cd java/target;jar -uf $(ROCKSDB_JAR_ALL) libterarkdbjni-*.so libterarkdbjni-*
cd java/target;jar -uf $(ROCKSDB_JAR_ALL) libterarkdbjni-*
#cd java/target;jar -uf $(ROCKSDB_JAR_ALL) libterarkdbjni-*.so libterarkdbjni-*
cd java/target/classes;jar -uf ../$(ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class

# update apache license
Expand Down
11 changes: 8 additions & 3 deletions db/db_filesnapshot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,14 @@ Status DBImpl::FakeFlush(std::vector<std::string>& ret) {
VersionEdit* edit = &iter->second;
autovector<MemTable*> mems;
cfd->imm()->PickMemtablesToFlush(nullptr,&mems);
for(auto& m: mems){
status = WriteLevel0TableForRecovery(job_id, cfd, m , edit);
if(!status.ok()) break;
if (!mems.empty()) {
cfd->imm()->RollbackMemtableFlush(mems, 0, status);
}
if (status.ok()) {
for (auto& m : mems) {
status = WriteLevel0TableForRecovery(job_id, cfd, m, edit);
if (!status.ok()) break;
}
}
if(status.ok()){
status = WriteLevel0TableForRecovery(job_id, cfd, cfd->mem(), edit);
Expand Down
29 changes: 16 additions & 13 deletions utilities/checkpoint/checkpoint_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,19 +252,22 @@ TEST_F(CheckpointTest, GetSnapshotLink) {
std::string key = std::string("foo");
ASSERT_OK(Put(key, "v1"));
// Take a snapshot
ASSERT_OK(Checkpoint::Create(db_, &checkpoint));
ASSERT_OK(checkpoint->CreateCheckpoint(snapshot_name_, log_size_for_flush));
ASSERT_OK(Put(key, "v2"));
ASSERT_EQ("v2", Get(key));
ASSERT_OK(Flush());
ASSERT_EQ("v2", Get(key));
// Open snapshot and verify contents while DB is running
options.create_if_missing = false;
ASSERT_OK(DB::Open(options, snapshot_name_, &snapshotDB));
ASSERT_OK(snapshotDB->Get(roptions, key, &result));
ASSERT_EQ("v1", result);
delete snapshotDB;
snapshotDB = nullptr;
for (int i = 0; i < 10; i++) {
ASSERT_OK(Checkpoint::Create(db_, &checkpoint));
ASSERT_OK(
checkpoint->CreateCheckpoint(snapshot_name_, log_size_for_flush));
ASSERT_OK(Put(key, "v2"));
ASSERT_EQ("v2", Get(key));
ASSERT_OK(Flush());
ASSERT_EQ("v2", Get(key));
// Open snapshot and verify contents while DB is running
options.create_if_missing = false;
ASSERT_OK(DB::Open(options, snapshot_name_, &snapshotDB));
ASSERT_OK(snapshotDB->Get(roptions, key, &result));
ASSERT_EQ("v1", result);
delete snapshotDB;
snapshotDB = nullptr;
}
delete db_;
db_ = nullptr;

Expand Down

0 comments on commit b90db8c

Please sign in to comment.