Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #318 from haolifei/oringin-master
Browse files Browse the repository at this point in the history
galaxy agent 持久化pod信息时采用同步方式
  • Loading branch information
taotaowill committed Mar 23, 2016
2 parents 1960ef0 + 59b8db6 commit b867d9e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/agent/persistence_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ bool PersistenceHandler::SavePodInfo(const PodInfo& pod_info) {
return false;
}


leveldb::WriteOptions ops;
ops.sync = true;
leveldb::Status write_status =
persistence_handler_->Put(leveldb::WriteOptions(),
key, value);
persistence_handler_->Put(ops, key, value);
if (!write_status.ok()) {
LOG(WARNING, "persistence for pod %s write failed %s",
key.c_str(),
Expand Down Expand Up @@ -123,8 +125,10 @@ bool PersistenceHandler::DeletePodInfo(const std::string& pod_id) {
return false;
}
std::string key = pod_id;
leveldb::WriteOptions ops;
ops.sync = true;
leveldb::Status status =
persistence_handler_->Delete(leveldb::WriteOptions(), key);
persistence_handler_->Delete(ops, key);
if (!status.ok()) {
LOG(WARNING, "delete pod %s failed %s",
key.c_str(),
Expand Down

0 comments on commit b867d9e

Please sign in to comment.