Skip to content

Commit

Permalink
CowSubscriptionManager: handle publish for HybridNode
Browse files Browse the repository at this point in the history
Summary: Fix handling of publish paths in when traversing HybridNode.

Reviewed By: wilsonwinhi

Differential Revision: D67162095

fbshipit-source-id: 3e8b1a8c77e8e6690ddb9422eb96711456daeb88
  • Loading branch information
Priyank Warkhede authored and facebook-github-bot committed Dec 14, 2024
1 parent 07a1be3 commit a9f2ca6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 10 additions & 4 deletions fboss/fsdb/oper/CowSubscriptionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,16 @@ class CowSubscriptionManager
auto processPath = [&](const std::vector<std::string>& /*path*/,
auto&& node) mutable {
if constexpr (is_shared_ptr_v<folly::remove_cvref_t<decltype(node)>>) {
// We only want to publish the node itself, not recurse to
// children. This invokes the base version of publish to
// avoid recursing automatically.
node->NodeBase::publish();
// skip publish on HybridNode.
if constexpr (!std::is_same_v<
typename folly::remove_cvref_t<
decltype(*node)>::CowType,
thrift_cow::HybridNodeType>) {
// We only want to publish the node itself, not recurse to
// children. This invokes the base version of publish to
// avoid recursing automatically.
node->NodeBase::publish();
}
}
};

Expand Down
7 changes: 5 additions & 2 deletions fboss/thrift_cow/visitors/RecurseVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,12 @@ struct RecurseVisitor<
throw std::runtime_error(folly::to<std::string>(
"RecurseVisitor support for hybridNodeDeepTraversal in Map not implemented"));
}
if (options.mode == RecurseVisitMode::UNPUBLISHED) {
rv_detail::invokeVisitorFnHelper(traverser, node, std::forward<Func>(f));
return;
}
auto& tObj = node->ref();
bool visitIntermediate = options.mode == RecurseVisitMode::FULL ||
options.mode == RecurseVisitMode::UNPUBLISHED;
bool visitIntermediate = options.mode == RecurseVisitMode::FULL;
if (visitIntermediate &&
options.order == RecurseVisitOrder::PARENTS_FIRST) {
rv_detail::invokeVisitorFnHelper(traverser, node, std::forward<Func>(f));
Expand Down

0 comments on commit a9f2ca6

Please sign in to comment.