Skip to content

Revert "Disable coordinator if no ingress tasks (#472)" #1083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions ydb/core/fq/libs/checkpointing/checkpoint_coordinator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ void TCheckpointCoordinator::Handle(NYql::NDqs::TEvReadyState::TPtr& ev) {
AllActorsSet.insert(actorId);
}

CC_LOG_D("ActorsToTrigger count: " << ActorsToTrigger.size() << ", ActorsToNotify count: " << ActorsToNotify.size() << ", ActorsToWaitFor count: " << ActorsToWaitFor.size());

if (ActorsToTrigger.empty()) {
CC_LOG_D("No ingress tasks, coordinator was disabled");
return;
}
PendingInit = std::make_unique<TPendingInitCoordinator>(AllActors.size());

CC_LOG_D("Send TEvRegisterCoordinatorRequest");
Expand Down
31 changes: 10 additions & 21 deletions ydb/core/fq/libs/checkpointing/ut/checkpoint_coordinator_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum ETestGraphFlags : ui64 {
SourceWithChannelInOneTask = 2,
};

NYql::NDqProto::TReadyState BuildTestGraph(ui64 flags, const TString& sourceType) {
NYql::NDqProto::TReadyState BuildTestGraph(ui64 flags = 0) {

NYql::NDqProto::TReadyState result;

Expand All @@ -29,7 +29,7 @@ NYql::NDqProto::TReadyState BuildTestGraph(ui64 flags, const TString& sourceType
ingressOutput->AddChannels();
if (flags & ETestGraphFlags::InputWithSource) {
auto* source = ingress->AddInputs()->MutableSource();
source->SetType(sourceType);
source->SetType("PqSource");
}

auto* map = result.AddTask();
Expand All @@ -40,7 +40,7 @@ NYql::NDqProto::TReadyState BuildTestGraph(ui64 flags, const TString& sourceType
mapOutput->AddChannels();
if (flags & ETestGraphFlags::SourceWithChannelInOneTask) {
auto* source = map->AddInputs()->MutableSource();
source->SetType(sourceType);
source->SetType("PqSource");
}

auto* egress = result.AddTask();
Expand Down Expand Up @@ -70,9 +70,9 @@ struct TTestBootstrap : public TTestActorRuntime {

::NMonitoring::TDynamicCounterPtr Counters = new ::NMonitoring::TDynamicCounters();

explicit TTestBootstrap(ui64 graphFlags, const TString& sourceType)
explicit TTestBootstrap(ui64 graphFlags = 0)
: TTestActorRuntime(true)
, GraphState(BuildTestGraph(graphFlags, sourceType))
, GraphState(BuildTestGraph(graphFlags))
, CoordinatorId("my-graph-id", 42)
, CheckpointId(CoordinatorId.Generation, 1)
{
Expand Down Expand Up @@ -281,8 +281,8 @@ Y_UNIT_TEST_SUITE(TCheckpointCoordinatorTests) {
class CheckpointsTestHelper : public TTestBootstrap
{
public:
CheckpointsTestHelper(ui64 graphFlags, const TString& sourceType)
: TTestBootstrap(graphFlags, sourceType) {
CheckpointsTestHelper(ui64 graphFlags)
: TTestBootstrap(graphFlags) {
}

void InjectCheckpoint() {
Expand Down Expand Up @@ -372,33 +372,22 @@ Y_UNIT_TEST_SUITE(TCheckpointCoordinatorTests) {
};

Y_UNIT_TEST(ShouldTriggerCheckpointWithSource) {
CheckpointsTestHelper test(ETestGraphFlags::InputWithSource, "PqSource");
CheckpointsTestHelper test(ETestGraphFlags::InputWithSource);
test.InjectCheckpoint();
test.AllSavedAndCommited();
}

Y_UNIT_TEST(ShouldTriggerCheckpointWithSourcesAndWithChannel) {
CheckpointsTestHelper test(ETestGraphFlags::InputWithSource | ETestGraphFlags::SourceWithChannelInOneTask, "PqSource");
CheckpointsTestHelper test(ETestGraphFlags::InputWithSource | ETestGraphFlags::SourceWithChannelInOneTask);
test.InjectCheckpoint();
test.AllSavedAndCommited();
}

Y_UNIT_TEST(ShouldAbortPreviousCheckpointsIfNodeStateCantBeSaved) {
CheckpointsTestHelper test(ETestGraphFlags::InputWithSource, "PqSource");
CheckpointsTestHelper test(ETestGraphFlags::InputWithSource);
test.InjectCheckpoint();
test.SaveFailed();
}

Y_UNIT_TEST(ShouldDoNothingIfNoIngressTasks) {
CheckpointsTestHelper test(ETestGraphFlags::InputWithSource, "S3Source");
bool empty = false;
try {
test.GrabEdgeEvent<TEvCheckpointStorage::TEvRegisterCoordinatorRequest>(test.StorageProxy, TDuration::Seconds(10));
} catch (TEmptyEventQueueException&) {
empty = true;
}
UNIT_ASSERT(empty);
}
}

} // namespace NFq