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

Commit b867d9e

Browse files
author
taotaowill
committed
Merge pull request #318 from haolifei/oringin-master
galaxy agent 持久化pod信息时采用同步方式
2 parents 1960ef0 + 59b8db6 commit b867d9e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/agent/persistence_handler.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ bool PersistenceHandler::SavePodInfo(const PodInfo& pod_info) {
6060
return false;
6161
}
6262

63+
64+
leveldb::WriteOptions ops;
65+
ops.sync = true;
6366
leveldb::Status write_status =
64-
persistence_handler_->Put(leveldb::WriteOptions(),
65-
key, value);
67+
persistence_handler_->Put(ops, key, value);
6668
if (!write_status.ok()) {
6769
LOG(WARNING, "persistence for pod %s write failed %s",
6870
key.c_str(),
@@ -123,8 +125,10 @@ bool PersistenceHandler::DeletePodInfo(const std::string& pod_id) {
123125
return false;
124126
}
125127
std::string key = pod_id;
128+
leveldb::WriteOptions ops;
129+
ops.sync = true;
126130
leveldb::Status status =
127-
persistence_handler_->Delete(leveldb::WriteOptions(), key);
131+
persistence_handler_->Delete(ops, key);
128132
if (!status.ok()) {
129133
LOG(WARNING, "delete pod %s failed %s",
130134
key.c_str(),

0 commit comments

Comments
 (0)