Skip to content

Commit 26b808f

Browse files
authored
Don't use Now() during replay for yt settings (#10732)
1 parent 7d2c257 commit 26b808f

15 files changed

+57
-50
lines changed

ydb/library/yql/core/extract_predicate/ut/extract_predicate_ut.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ Y_UNIT_TEST_SUITE(TYqlExtractPredicate) {
4444
auto ytGateway = CreateYtFileGateway(yqlNativeServices);
4545
typesCtx = MakeIntrusive<TTypeAnnotationContext>();
4646
typesCtx->RandomProvider = CreateDeterministicRandomProvider(1);
47-
auto ytState = MakeIntrusive<TYtState>();
47+
auto ytState = MakeIntrusive<TYtState>(typesCtx.Get());
4848
ytState->Gateway = ytGateway;
49-
ytState->Types = typesCtx.Get();
5049

5150
InitializeYtGateway(ytGateway, ytState);
5251
typesCtx->AddDataSink(YtProviderName, CreateYtDataSink(ytState));

ydb/library/yql/core/facade/yql_facade.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ TProgram::TProgram(
312312
QContext_.GetWriter()->Put({FacadeComponent, StaticCredentialsLabel}, credList).GetValueSync();
313313
} else if (QContext_.CanRead()) {
314314
Credentials_ = MakeIntrusive<TCredentials>();
315+
Credentials_->SetUserCredentials({
316+
.OauthToken = "REPLAY_OAUTH",
317+
.BlackboxSessionIdCookie = "REPLAY_SESSIONID"
318+
});
319+
315320
for (const auto& label : {StaticCredentialsLabel, DynamicCredentialsLabel}) {
316321
auto item = QContext_.GetReader()->Get({FacadeComponent, label}).GetValueSync();
317322
if (item) {

ydb/library/yql/core/ut/yql_expr_constraint_ut.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ Y_UNIT_TEST_SUITE(TYqlExprConstraints) {
3131
auto ytGateway = CreateYtFileGateway(yqlNativeServices);
3232
auto typeAnnotationContext = MakeIntrusive<TTypeAnnotationContext>();
3333
typeAnnotationContext->RandomProvider = CreateDeterministicRandomProvider(1);
34-
auto ytState = MakeIntrusive<TYtState>();
34+
auto ytState = MakeIntrusive<TYtState>(typeAnnotationContext.Get());
3535
ytState->Gateway = ytGateway;
36-
ytState->Types = typeAnnotationContext.Get();
3736

3837
InitializeYtGateway(ytGateway, ytState);
3938
typeAnnotationContext->AddDataSink(YtProviderName, CreateYtDataSink(ytState));

ydb/library/yql/core/ut/yql_expr_discover_ut.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ Y_UNIT_TEST_SUITE(TDiscoverYqlExpr) {
3131
auto ytGateway = CreateYtFileGateway(yqlNativeServices);
3232
auto typeAnnotationContext = MakeIntrusive<TTypeAnnotationContext>();
3333
typeAnnotationContext->DiscoveryMode = true;
34-
auto ytState = MakeIntrusive<TYtState>();
34+
auto ytState = MakeIntrusive<TYtState>(typeAnnotationContext.Get());
3535
ytState->Gateway = ytGateway;
36-
ytState->Types = typeAnnotationContext.Get();
3736

3837
InitializeYtGateway(ytGateway, ytState);
3938
auto randomProvider = CreateDeterministicRandomProvider(1);

ydb/library/yql/core/ut/yql_expr_optimize_ut.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,8 @@ Y_UNIT_TEST_SUITE(TOptimizeYqlExpr) {
592592
auto yqlNativeServices = NFile::TYtFileServices::Make(functionRegistry.Get(), testTables);
593593
auto ytGateway = CreateYtFileGateway(yqlNativeServices);
594594
auto typeAnnotationContext = MakeIntrusive<TTypeAnnotationContext>();
595-
auto ytState = MakeIntrusive<TYtState>();
595+
auto ytState = MakeIntrusive<TYtState>(typeAnnotationContext.Get());
596596
ytState->Gateway = ytGateway;
597-
ytState->Types = typeAnnotationContext.Get();
598597

599598
InitializeYtGateway(ytGateway, ytState);
600599
auto randomProvider = CreateDeterministicRandomProvider(1);

ydb/library/yql/core/ut/yql_expr_providers_ut.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ Y_UNIT_TEST_SUITE(TCompileWithProvidersYqlExpr) {
5959
auto yqlNativeServices = NFile::TYtFileServices::Make(functionRegistry.Get(), testTables);
6060
auto ytGateway = CreateYtFileGateway(yqlNativeServices);
6161
auto typeAnnotationContext = MakeIntrusive<TTypeAnnotationContext>();
62-
auto ytState = MakeIntrusive<TYtState>();
62+
auto ytState = MakeIntrusive<TYtState>(typeAnnotationContext.Get());
6363
ytState->Gateway = ytGateway;
64-
ytState->Types = typeAnnotationContext.Get();
6564

6665
InitializeYtGateway(ytGateway, ytState);
6766
typeAnnotationContext->AddDataSink(YtProviderName, CreateYtDataSink(ytState));

ydb/library/yql/providers/common/provider/yql_provider.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,12 +1155,15 @@ std::pair<IGraphTransformer::TStatus, TAsyncTransformCallbackFuture> FreezeUsedF
11551155
return SyncError();
11561156
}
11571157

1158+
if (types.QContext.CanRead()) {
1159+
return SyncOk();
1160+
}
1161+
11581162
auto future = FreezeUserDataTableIfNeeded(types.UserDataStorage, files, urlDownloadFilter);
11591163
if (future.Wait(TDuration::Zero())) {
11601164
files = future.GetValue()();
11611165
return SyncOk();
1162-
}
1163-
else {
1166+
} else {
11641167
return std::make_pair(IGraphTransformer::TStatus::Async, future.Apply(
11651168
[](const NThreading::TFuture<std::function<TUserDataTable()>>& completedFuture) {
11661169
return TAsyncTransformCallback([completedFuture](const TExprNode::TPtr& input, TExprNode::TPtr& output, TExprContext& ctx) {

ydb/library/yql/providers/yt/common/yql_yt_settings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void MediaValidator(const NYT::TNode& value) {
5454
}
5555
}
5656

57-
TYtConfiguration::TYtConfiguration()
57+
TYtConfiguration::TYtConfiguration(TTypeAnnotationContext& typeCtx)
5858
{
5959
const auto codecValidator = [] (const TString&, TString str) {
6060
if (!ValidateCompressionCodecValue(str)) {
@@ -188,7 +188,7 @@ TYtConfiguration::TYtConfiguration()
188188
}
189189
});
190190
REGISTER_SETTING(*this, ExpirationDeadline)
191-
.Lower(Now())
191+
.Lower(typeCtx.QContext.CanRead() ? TInstant::Zero() : Now())
192192
.ValueSetter([this] (const TString& cluster, TInstant value) {
193193
ExpirationDeadline[cluster] = value;
194194
});

ydb/library/yql/providers/yt/common/yql_yt_settings.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ inline TString GetTablesTmpFolder(const TYtSettings& settings) {
295295
struct TYtConfiguration : public TYtSettings, public NCommon::TSettingDispatcher {
296296
using TPtr = TIntrusivePtr<TYtConfiguration>;
297297

298-
TYtConfiguration();
298+
TYtConfiguration(TTypeAnnotationContext& typeCtx);
299299
TYtConfiguration(const TYtConfiguration&) = delete;
300300

301301
template <class TProtoConfig, typename TFilter>
@@ -336,7 +336,11 @@ class TYtVersionedConfiguration: public TYtConfiguration {
336336
TYtSettings::TConstPtr Snapshot;
337337
};
338338

339-
TYtVersionedConfiguration() = default;
339+
TYtVersionedConfiguration(TTypeAnnotationContext& types)
340+
: TYtConfiguration(types)
341+
{
342+
}
343+
340344
~TYtVersionedConfiguration() = default;
341345

342346
size_t FindNodeVer(const TExprNode& node);

ydb/library/yql/providers/yt/gateway/native/ut/yql_yt_native_folders_ut.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,14 @@ class TYtReplier : public TRequestReplier {
185185

186186
Y_UNIT_TEST_SUITE(YtNativeGateway) {
187187

188-
std::pair<TIntrusivePtr<TYtState>, IYtGateway::TPtr> InitTest(const NTesting::TPortHolder& port) {
188+
std::pair<TIntrusivePtr<TYtState>, IYtGateway::TPtr> InitTest(const NTesting::TPortHolder& port, TTypeAnnotationContext* types) {
189189
TYtNativeServices nativeServices;
190190
auto gatewaysConfig = MakeGatewaysConfig(port);
191191
nativeServices.Config = std::make_shared<TYtGatewayConfig>(gatewaysConfig.GetYt());
192192
nativeServices.FileStorage = CreateFileStorage(TFileStorageConfig{});
193193

194194
auto ytGateway = CreateYtNativeGateway(nativeServices);
195-
auto ytState = MakeIntrusive<TYtState>();
195+
auto ytState = MakeIntrusive<TYtState>(types);
196196
ytState->Gateway = ytGateway;
197197

198198
InitializeYtGateway(ytGateway, ytState);
@@ -206,7 +206,8 @@ TMaybe<std::function<void(const NYT::TNode& request)>> gatewayRequestAssertion,
206206
[gatewayRequestAssertion, handleList, handleGet] () {return new TYtReplier(handleList, handleGet, gatewayRequestAssertion);}
207207
};
208208

209-
auto [ytState, ytGateway] = InitTest(port);
209+
TTypeAnnotationContext types;
210+
auto [ytState, ytGateway] = InitTest(port, &types);
210211

211212
IYtGateway::TFolderOptions folderOptions = makeFolderOptions(ytState->SessionId);
212213
auto folderFuture = ytGateway->GetFolder(std::move(folderOptions));

0 commit comments

Comments
 (0)