Skip to content

Commit

Permalink
Log dummy operations
Browse files Browse the repository at this point in the history
Summary:
Previously we added logging to log deprecated operations, so that if there are no deprecated operations in production, we can remove the relevant code.

However, if there are no deprecated operations in scuba, it's hard to tell whether logging has a bug, or we really didn't have deprecated operations.

This diff will rule-out the former case by logging some dummy operations so that we know the logging path works.

Reviewed By: thedavekwon

Differential Revision: D67959504

fbshipit-source-id: 4e2439954b68ddfb83155e174876f77a0fd93778
  • Loading branch information
TJ Yin authored and facebook-github-bot committed Jan 14, 2025
1 parent 0eb61a4 commit 0fa5fda
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions thrift/lib/cpp2/op/detail/ContainerPatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class ListPatch : public BaseContainerPatch<Patch, ListPatch<Patch>> {
return;
}

patch::detail::logDeprecatedOperation(
"ListPatch::Dummy", folly::pretty_name<T>(), "");
if (!data_.prepend()->empty()) {
auto msg = "Prepend in ListPatch is disallowed.";
LOG(DFATAL) << msg;
Expand Down
2 changes: 2 additions & 0 deletions thrift/lib/cpp2/protocol/Patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ void ApplyPatch::operator()(
insert_set(*validate_if_set(add, "add"));
}

patch::detail::logDeprecatedOperation("SetPatch::Dummy", "[dynamic]", "");
if (auto* put = findOp(patch, PatchOp::Put)) {
auto msg = "SetPatch::Put should be migrated to SetPatch::Add";
patch::detail::logDeprecatedOperation("SetPatch::Put", "[dynamic]", msg);
Expand Down Expand Up @@ -411,6 +412,7 @@ void ApplyPatch::operator()(

template <class Patch>
void impl(Patch&& patch, Object& value) {
patch::detail::logDeprecatedOperation("StructPatch::Dummy", "[dynamic]", "");
static_assert(std::is_same_v<folly::remove_cvref_t<Patch>, Object>);
checkOps(
patch,
Expand Down

0 comments on commit 0fa5fda

Please sign in to comment.