diff --git a/ydb/core/kqp/runtime/kqp_write_actor.cpp b/ydb/core/kqp/runtime/kqp_write_actor.cpp index a1d5979bf773..6bc51ca06ed5 100644 --- a/ydb/core/kqp/runtime/kqp_write_actor.cpp +++ b/ydb/core/kqp/runtime/kqp_write_actor.cpp @@ -1103,7 +1103,7 @@ class TKqpTableWriteActor : public TActorBootstrapped { void RetryShard(const ui64 shardId, const std::optional ifCookieEqual) { const auto metadata = ShardedWriteController->GetMessageMetadata(shardId); if (!metadata || (ifCookieEqual && metadata->Cookie != ifCookieEqual)) { - CA_LOG_W("Retry failed: not found ShardID=" << shardId << " with Cookie=" << ifCookieEqual.value_or(0)); + CA_LOG_I("Retry failed: not found ShardID=" << shardId << " with Cookie=" << ifCookieEqual.value_or(0)); return; } @@ -1119,7 +1119,7 @@ class TKqpTableWriteActor : public TActorBootstrapped { } void Handle(TEvPrivate::TEvShardRequestTimeout::TPtr& ev) { - CA_LOG_W("Timeout shardID=" << ev->Get()->ShardId); + CA_LOG_I("Timeout shardID=" << ev->Get()->ShardId); YQL_ENSURE(InconsistentTx); RetryShard(ev->Get()->ShardId, ev->Cookie); } diff --git a/ydb/core/tx/schemeshard/schemeshard__background_cleaning.cpp b/ydb/core/tx/schemeshard/schemeshard__background_cleaning.cpp index ac246aa24f36..6993ef963c96 100644 --- a/ydb/core/tx/schemeshard/schemeshard__background_cleaning.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__background_cleaning.cpp @@ -62,6 +62,7 @@ NOperationQueue::EStartStatus TSchemeShard::StartBackgroundCleaning(const TPathI auto ctx = ActorContext(); LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "RunBackgroundCleaning " "for temp dir# " << JoinPath({info->WorkingDir, info->Name}) + << ", pathId# " << pathId << ", ownerId# " << info->TempDirOwnerActorId << ", next wakeup# " << BackgroundCleaningQueue->GetWakeupDelta() << ", rate# " << BackgroundCleaningQueue->GetRate() @@ -309,6 +310,13 @@ void TSchemeShard::RetryNodeSubscribe(ui32 nodeId) { } retryState.RetryNumber++; + auto ctx = ActorContext(); + LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "Retry node subscribe BackgroundCleaning " + "for nodeId# " << nodeId + << ", count of retries# " << retryState.RetryNumber + << ", retries limit# " << BackgroundCleaningRetrySettings.GetMaxRetryNumber() + << ", last retry at# " << retryState.LastRetryAt + << " at schemeshard " << TabletID()); if (retryState.RetryNumber > BackgroundCleaningRetrySettings.GetMaxRetryNumber()) { for (const auto& ownerActorId: nodeState.Owners) { @@ -359,6 +367,11 @@ bool TSchemeShard::CheckOwnerUndelivered(TEvents::TEvUndelivered::TPtr& ev) { } auto& currentTempDirs = it->second; + auto ctx = ActorContext(); + LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "Owner undelivered for BackgroundCleaning " + "for ownerActorId# " << ownerActorId + << ", undelivered reason# " << ev->Get()->Reason + << " at schemeshard " << TabletID()); for (auto& pathId: currentTempDirs) { EnqueueBackgroundCleaning(pathId); diff --git a/ydb/core/tx/schemeshard/schemeshard__init.cpp b/ydb/core/tx/schemeshard/schemeshard__init.cpp index f9a71d29acfa..6c9576f0b2a5 100644 --- a/ydb/core/tx/schemeshard/schemeshard__init.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__init.cpp @@ -112,7 +112,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase { rowSet.template GetValueOrDefault(1), rowSet.template GetValueOrDefault(1), rowSet.template GetValueOrDefault(0), - rowSet.template GetValueOrDefault() + rowSet.template GetValueOrDefault() ); } @@ -138,7 +138,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase { TPathElement::TPtr path = new TPathElement(pathId, parentPathId, domainId, name, owner); - TString tempDirOwnerActorId; + TString tempDirOwnerActorIdProto; std::tie( std::ignore, //pathId std::ignore, //parentPathId @@ -154,14 +154,16 @@ struct TSchemeShard::TTxInit : public TTransactionBase { path->DirAlterVersion, path->UserAttrs->AlterVersion, path->ACLVersion, - tempDirOwnerActorId) = rec; + tempDirOwnerActorIdProto) = rec; path->PathState = TPathElement::EPathState::EPathStateNoChanges; if (path->StepDropped) { path->PathState = TPathElement::EPathState::EPathStateNotExist; } - path->TempDirOwnerActorId.Parse(tempDirOwnerActorId.c_str(), tempDirOwnerActorId.size()); + if (NActorsProto::TActorId protoId; protoId.ParseFromString(tempDirOwnerActorIdProto)) { + path->TempDirOwnerActorId = ActorIdFromProto(protoId); + } return path; } diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp index 98821c8234e7..5ea8147b3164 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp @@ -2111,6 +2111,10 @@ void TSchemeShard::PersistLastTxId(NIceDb::TNiceDb& db, const TPathElement::TPtr void TSchemeShard::PersistPath(NIceDb::TNiceDb& db, const TPathId& pathId) { Y_ABORT_UNLESS(PathsById.contains(pathId)); TPathElement::TPtr elem = PathsById.at(pathId); + + NActorsProto::TActorId tempDirOwnerActorIdProto; + ActorIdToProto(elem->TempDirOwnerActorId, &tempDirOwnerActorIdProto); + if (IsLocalId(pathId)) { db.Table().Key(pathId.LocalPathId).Update( NIceDb::TUpdate(elem->ParentPathId.OwnerId), @@ -2127,7 +2131,8 @@ void TSchemeShard::PersistPath(NIceDb::TNiceDb& db, const TPathId& pathId) { NIceDb::TUpdate(elem->DirAlterVersion), NIceDb::TUpdate(elem->UserAttrs->AlterVersion), NIceDb::TUpdate(elem->ACLVersion), - NIceDb::TUpdate(elem->TempDirOwnerActorId.ToString()) + NIceDb::TUpdate(elem->TempDirOwnerActorId.ToString()), + NIceDb::TUpdate(tempDirOwnerActorIdProto.SerializeAsString()) ); } else { db.Table().Key(pathId.OwnerId, pathId.LocalPathId).Update( @@ -2145,7 +2150,8 @@ void TSchemeShard::PersistPath(NIceDb::TNiceDb& db, const TPathId& pathId) { NIceDb::TUpdate(elem->DirAlterVersion), NIceDb::TUpdate(elem->UserAttrs->AlterVersion), NIceDb::TUpdate(elem->ACLVersion), - NIceDb::TUpdate(elem->TempDirOwnerActorId.ToString()) + NIceDb::TUpdate(elem->TempDirOwnerActorId.ToString()), + NIceDb::TUpdate(tempDirOwnerActorIdProto.SerializeAsString()) ); } } diff --git a/ydb/core/tx/schemeshard/schemeshard_schema.h b/ydb/core/tx/schemeshard/schemeshard_schema.h index 7a599fcaaebb..0dd08dc265ff 100644 --- a/ydb/core/tx/schemeshard/schemeshard_schema.h +++ b/ydb/core/tx/schemeshard/schemeshard_schema.h @@ -35,14 +35,15 @@ struct Schema : NIceDb::Schema { struct UserAttrsAlterVersion : Column<14, NScheme::NTypeIds::Uint64> {}; struct ACLVersion : Column<15, NScheme::NTypeIds::Uint64> {}; struct ParentOwnerId : Column<16, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId; }; - struct TempDirOwnerActorId : Column<17, NScheme::NTypeIds::String> {}; // Only for EPathType::EPathTypeDir. - // Not empty if dir must be deleted after loosing connection with TempDirOwnerActorId actor. - // See schemeshard__background_cleaning.cpp. + struct TempDirOwnerActorId : Column<17, NScheme::NTypeIds::String> {}; // legacy + struct TempDirOwnerActorIdProto : Column<18, NScheme::NTypeIds::String> {}; // Only for EPathType::EPathTypeDir. + // Not empty if dir must be deleted after loosing connection with TempDirOwnerActorId actor. + // See schemeshard__background_cleaning.cpp. using TKey = TableKey; using TColumns = TableColumns; + ParentOwnerId, TempDirOwnerActorId, TempDirOwnerActorIdProto>; }; struct MigratedPaths : Table<50> { @@ -62,13 +63,15 @@ struct Schema : NIceDb::Schema { struct DirAlterVersion : Column<14, NScheme::NTypeIds::Uint64> {}; struct UserAttrsAlterVersion : Column<15, NScheme::NTypeIds::Uint64> {}; struct ACLVersion : Column<16, NScheme::NTypeIds::Uint64> {}; - struct TempDirOwnerActorId : Column<17, NScheme::NTypeIds::String> {}; // Only for EPathType::EPathTypeDir. - // Not empty if dir must be deleted after loosing connection with TempDirOwnerActorId actor. - // See schemeshard__background_cleaning.cpp. + struct TempDirOwnerActorId : Column<17, NScheme::NTypeIds::String> {}; // legacy + struct TempDirOwnerActorIdProto : Column<18, NScheme::NTypeIds::String> {}; // Only for EPathType::EPathTypeDir. + // Not empty if dir must be deleted after loosing connection with TempDirOwnerActorId actor. + // See schemeshard__background_cleaning.cpp. using TKey = TableKey; using TColumns = TableColumns; + StepDropped, DropTxId, Owner, ACL, LastTxId, DirAlterVersion, UserAttrsAlterVersion, ACLVersion, TempDirOwnerActorId, + TempDirOwnerActorIdProto>; }; struct TxInFlight : Table<2> { // not in use diff --git a/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_schemeshard_/flat_schemeshard.schema b/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_schemeshard_/flat_schemeshard.schema index b5e7138d8f3c..4d2510344dda 100644 --- a/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_schemeshard_/flat_schemeshard.schema +++ b/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_schemeshard_/flat_schemeshard.schema @@ -6,11 +6,6 @@ 1 ], "ColumnsAdded": [ - { - "ColumnId": 17, - "ColumnName": "TempDirOwnerActorId", - "ColumnType": "String" - }, { "ColumnId": 1, "ColumnName": "Id", @@ -90,13 +85,22 @@ "ColumnId": 16, "ColumnName": "ParentOwnerId", "ColumnType": "Uint64" + }, + { + "ColumnId": 17, + "ColumnName": "TempDirOwnerActorId", + "ColumnType": "String" + }, + { + "ColumnId": 18, + "ColumnName": "TempDirOwnerActorIdProto", + "ColumnType": "String" } ], "ColumnsDropped": [], "ColumnFamilies": { "0": { "Columns": [ - 17, 1, 2, 3, @@ -112,7 +116,9 @@ 13, 14, 15, - 16 + 16, + 17, + 18 ], "RoomID": 0, "Codec": 0, @@ -3537,11 +3543,6 @@ 2 ], "ColumnsAdded": [ - { - "ColumnId": 17, - "ColumnName": "TempDirOwnerActorId", - "ColumnType": "String" - }, { "ColumnId": 1, "ColumnName": "OwnerPathId", @@ -3621,13 +3622,22 @@ "ColumnId": 16, "ColumnName": "ACLVersion", "ColumnType": "Uint64" + }, + { + "ColumnId": 17, + "ColumnName": "TempDirOwnerActorId", + "ColumnType": "String" + }, + { + "ColumnId": 18, + "ColumnName": "TempDirOwnerActorIdProto", + "ColumnType": "String" } ], "ColumnsDropped": [], "ColumnFamilies": { "0": { "Columns": [ - 17, 1, 2, 3, @@ -3643,7 +3653,9 @@ 13, 14, 15, - 16 + 16, + 17, + 18 ], "RoomID": 0, "Codec": 0,