Skip to content

Commit

Permalink
fix GetSnaphot will return nullptr (#5420)
Browse files Browse the repository at this point in the history
* fix GetSnaphot will return nullptr

* fix compile

---------

Co-authored-by: Sophie <[email protected]>
  • Loading branch information
critical27 and Sophie-Xie authored Mar 21, 2023
1 parent 05ca117 commit e3ae20d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 17 deletions.
4 changes: 1 addition & 3 deletions src/kvstore/KVStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ class KVStore {
* @param canReadFromFollower
* @return const void* Snapshot.
*/
virtual const void* GetSnapshot(GraphSpaceID spaceId,
PartitionID partID,
bool canReadFromFollower = false) = 0;
virtual const void* GetSnapshot(GraphSpaceID spaceId, PartitionID partID) = 0;

/**
* @brief Release snapshot.
Expand Down
7 changes: 1 addition & 6 deletions src/kvstore/NebulaStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,17 +732,12 @@ nebula::cpp2::ErrorCode NebulaStore::get(GraphSpaceID spaceId,
return part->engine()->get(key, value, snapshot);
}

const void* NebulaStore::GetSnapshot(GraphSpaceID spaceId,
PartitionID partId,
bool canReadFromFollower) {
const void* NebulaStore::GetSnapshot(GraphSpaceID spaceId, PartitionID partId) {
auto ret = part(spaceId, partId);
if (!ok(ret)) {
return nullptr;
}
auto part = nebula::value(ret);
if (!checkLeader(part, canReadFromFollower)) {
return nullptr;
}
return part->engine()->GetSnapshot();
}

Expand Down
5 changes: 1 addition & 4 deletions src/kvstore/NebulaStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,9 @@ class NebulaStore : public KVStore, public Handler {
*
* @param spaceId
* @param partID
* @param canReadFromFollower
* @return const void* Snapshot pointer.
*/
const void* GetSnapshot(GraphSpaceID spaceId,
PartitionID partID,
bool canReadFromFollower = false) override;
const void* GetSnapshot(GraphSpaceID spaceId, PartitionID partID) override;

/**
* @brief Release snapshot from engine.
Expand Down
4 changes: 1 addition & 3 deletions src/kvstore/plugins/hbase/HBaseStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ class HBaseStore : public KVStore {
return {-1, -1};
}

const void* GetSnapshot(GraphSpaceID spaceId,
PartitionID partID,
bool canReadFromFollower = false) override {
const void* GetSnapshot(GraphSpaceID spaceId, PartitionID partID) override {
UNUSED(spaceId);
UNUSED(partID);
UNUSED(canReadFromFollower);
Expand Down
2 changes: 1 addition & 1 deletion src/storage/test/IndexTestUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class MockKVStore : public ::nebula::kvstore::KVStore {
return nebula::cpp2::ErrorCode::SUCCEEDED;
}

const void* GetSnapshot(GraphSpaceID, PartitionID, bool) override {
const void* GetSnapshot(GraphSpaceID, PartitionID) override {
return nullptr;
}
void ReleaseSnapshot(GraphSpaceID, PartitionID, const void*) override {}
Expand Down

0 comments on commit e3ae20d

Please sign in to comment.