Skip to content

Commit

Permalink
server-side changes for SET distribution
Browse files Browse the repository at this point in the history
Summary:
In this diff we add:
1. A callback to process SET requests from DL. The callback takes a `writeTimestamp` argument that will be passed down to the command handler (in the next diff). We will compare this writeTimestamp with the existing item's creation time and discard the write if the writeTimestamp is older than the item's creation time.
2. Refactor Bucket Manager to take two callbacks - one for delete, second for writes. Depending on the payload in WH update, we call the relevant callback.

In the next diffs we will add the logic in the MemcachedCommandHandler to accommodate the passed in `writeTimestamp`, as well as security logic.

Reviewed By: stuclar

Differential Revision: D57074727

fbshipit-source-id: 58c499fb9cc88e0fe0951312c362ffc70973414f
  • Loading branch information
Lenar Fatikhov authored and facebook-github-bot committed Nov 14, 2024
1 parent 58546f7 commit ffec051
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mcrouter/lib/carbon/RequestCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class RequestCommon : public MessageCommon {
sourceIpAddr_ = sourceIpAddr;
}

void setWriteTimestamp(uint64_t writeTimestamp) noexcept {
writeTimestamp_ = writeTimestamp;
}

protected:
void markBufferAsDirty() {
serializedBuffer_ = nullptr;
Expand All @@ -115,6 +119,8 @@ class RequestCommon : public MessageCommon {
std::optional<std::string> clientIdentifier_;
// Source ip address.
std::optional<folly::IPAddress> sourceIpAddr_;
// write timestamp
std::optional<uint64_t> writeTimestamp_;
};

} // namespace carbon

0 comments on commit ffec051

Please sign in to comment.