Skip to content

Commit

Permalink
Add gflag to bypass subscriber uniqueness
Browse files Browse the repository at this point in the history
Summary:
I want to be able to bypass the dup subscriber error in tests just so they dont pollute our benchmarking.

This is just a temp solution to only be enabled in testing/debugging. I'd like to replace this with either
A. tcp level heartbeats, which seem to come to us more reliably than stream level heartbeats
B. a proper mechanism to bypass this using a client side flag. That requires us to untagle a bit of a web since we'll want to boot the old subscription out, which we currently have no mechanism to do so

Differential Revision:
D61315052

Privacy Context Container: L1125642

fbshipit-source-id: 90e90beaefc85219f98643afb3a6154484cb208a
  • Loading branch information
Peyman Gardideh authored and facebook-github-bot committed Aug 15, 2024
1 parent 29af463 commit 76dac63
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions fboss/fsdb/server/ServiceHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ DEFINE_bool(
enforcePublisherConfig,
false,
"whether to enforce PublisherConfig for publish stream requests");
DEFINE_bool(
forceRegisterSubscriptions,
false,
"Whether to bypass unique subscriber check. Should only be used during debugging");

static constexpr auto kWatchdogThreadHeartbeatMissed =
"watchdog_thread_heartbeat_missed";
Expand Down Expand Up @@ -690,12 +694,16 @@ void ServiceHandler::registerSubscription(const OperSubscriberInfo& info) {
buildPathUnion(info),
*info.type(),
*info.isStats());
auto resp = activeSubscriptions_.wlock()->insert({std::move(key), info});
if (!resp.second) {
throw Utils::createFsdbException(
FsdbErrorCode::ID_ALREADY_EXISTS,
"Dup subscriber id: ",
*info.subscriberId());
if (FLAGS_forceRegisterSubscriptions) {
(*activeSubscriptions_.wlock())[std::move(key)] = info;
} else {
auto resp = activeSubscriptions_.wlock()->insert({std::move(key), info});
if (!resp.second) {
throw Utils::createFsdbException(
FsdbErrorCode::ID_ALREADY_EXISTS,
"Dup subscriber id: ",
*info.subscriberId());
}
}
updateSubscriptionCounters(info, true);
}
Expand Down

0 comments on commit 76dac63

Please sign in to comment.