-
Notifications
You must be signed in to change notification settings - Fork 647
Tests for wide combiner with spilling #6880
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
Changes from all commits
c330758
3413bac
896b505
bde88f9
1e82ca6
170b5d9
6c1f1c9
a442036
8167088
c7396a0
f18e7fd
48b00f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -521,7 +521,6 @@ class TSpillingSupportState : public TComputationValue<TSpillingSupportState> { | |
|
||
if (finishedCount != SpilledBuckets.size()) return true; | ||
|
||
YQL_LOG(INFO) << "switching to ProcessSpilled"; | ||
SwitchMode(EOperatingMode::ProcessSpilled); | ||
|
||
return ProcessSpilledDataAndWait(); | ||
|
@@ -551,11 +550,7 @@ class TSpillingSupportState : public TComputationValue<TSpillingSupportState> { | |
|
||
bool CheckMemoryAndSwitchToSpilling() { | ||
if (AllowSpilling && Ctx.SpillerFactory && IsSwitchToSpillingModeCondition()) { | ||
const auto used = TlsAllocState->GetUsed(); | ||
const auto limit = TlsAllocState->GetLimit(); | ||
|
||
YQL_LOG(INFO) << "yellow zone reached " << (used*100/limit) << "%=" << used << "/" << limit; | ||
YQL_LOG(INFO) << "switching Memory mode to Spilling"; | ||
LogMemoryUsage(); | ||
|
||
SwitchMode(EOperatingMode::Spilling); | ||
return true; | ||
|
@@ -564,6 +559,19 @@ class TSpillingSupportState : public TComputationValue<TSpillingSupportState> { | |
return false; | ||
} | ||
|
||
void LogMemoryUsage() const { | ||
const auto used = TlsAllocState->GetUsed(); | ||
const auto limit = TlsAllocState->GetLimit(); | ||
TStringBuilder logmsg; | ||
logmsg << "Memory usage: "; | ||
if (limit) { | ||
logmsg << (used*100/limit) << "%="; | ||
} | ||
logmsg << (used/1_MB) << "MB/" << (limit/1_MB) << "MB"; | ||
|
||
YQL_LOG(INFO) << logmsg; | ||
} | ||
|
||
void SpillMoreStateFromBucket(TSpilledBucket& bucket) { | ||
MKQL_ENSURE(!bucket.AsyncWriteOperation.has_value(), "Internal logic error"); | ||
|
||
|
@@ -688,10 +696,12 @@ class TSpillingSupportState : public TComputationValue<TSpillingSupportState> { | |
void SwitchMode(EOperatingMode mode) { | ||
switch(mode) { | ||
case EOperatingMode::InMemory: { | ||
YQL_LOG(INFO) << "switching Memory mode to InMemory"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here also in Debug? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed that this log would be written once per task, so we decided to leave the INFO level. |
||
MKQL_ENSURE(false, "Internal logic error"); | ||
break; | ||
} | ||
case EOperatingMode::Spilling: { | ||
YQL_LOG(INFO) << "switching Memory mode to Spilling"; | ||
MKQL_ENSURE(EOperatingMode::InMemory == Mode, "Internal logic error"); | ||
SpilledBuckets.resize(SpilledBucketCount); | ||
auto spiller = Ctx.SpillerFactory->CreateSpiller(); | ||
|
@@ -707,6 +717,7 @@ class TSpillingSupportState : public TComputationValue<TSpillingSupportState> { | |
break; | ||
} | ||
case EOperatingMode::ProcessSpilled: { | ||
YQL_LOG(INFO) << "switching Memory mode to ProcessSpilled"; | ||
MKQL_ENSURE(EOperatingMode::Spilling == Mode, "Internal logic error"); | ||
MKQL_ENSURE(SpilledBuckets.size() == SpilledBucketCount, "Internal logic error"); | ||
BufferForKeyAndState.resize(0); | ||
|
@@ -722,9 +733,7 @@ class TSpillingSupportState : public TComputationValue<TSpillingSupportState> { | |
} | ||
|
||
bool IsSwitchToSpillingModeCondition() const { | ||
return false; | ||
// TODO: YQL-18033 | ||
// return !HasMemoryForProcessing(); | ||
return !HasMemoryForProcessing(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please note that the hardcoded value is removed here |
||
} | ||
|
||
public: | ||
|
@@ -1250,7 +1259,6 @@ using TBaseComputation = TStatefulWideFlowCodegeneratorNode<TWideLastCombinerWra | |
, AllowSpilling(allowSpilling) | ||
{} | ||
|
||
// MARK: DoCAlculate | ||
EFetchResult DoCalculate(NUdf::TUnboxedValue& state, TComputationContext& ctx, NUdf::TUnboxedValue*const* output) const { | ||
if (!state.HasValue()) { | ||
MakeState(ctx, state); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we want to print it on Debug level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed that this log would be written once per task, so we decided to leave the INFO level.