Skip to content

Commit

Permalink
24-3: Reset __async_replica attr after changing REPLICATION_MODE to N…
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberROFL authored and spuchin committed Sep 9, 2024
1 parent 92c0d34 commit 7bc58fd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ydb/core/tx/schemeshard/schemeshard__init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Y_ABORT_UNLESS(parseOk);

if (tableInfo->IsAsyncReplica()) {
Self->PathsById.at(pathId)->SetAsyncReplica();
Self->PathsById.at(pathId)->SetAsyncReplica(true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ class TPropose: public TSubOperationState {
TTableInfo::TPtr table = context.SS->Tables.at(pathId);
table->FinishAlter();

if (!table->IsAsyncReplica()) {
path->SetAsyncReplica(false);
}

auto ttlIt = context.SS->TTLEnabledTables.find(pathId);
if (table->IsTTLEnabled() && ttlIt == context.SS->TTLEnabledTables.end()) {
context.SS->TTLEnabledTables[pathId] = table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ class TCreateTable: public TSubOperation {
Y_ABORT_UNLESS(tableInfo->GetPartitions().back().EndOfRange.empty(), "End of last range must be +INF");

if (tableInfo->IsAsyncReplica()) {
newTable->SetAsyncReplica();
newTable->SetAsyncReplica(true);
}

context.SS->Tables[newTable->PathId] = tableInfo;
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/tx/schemeshard/schemeshard_path_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ bool TPathElement::CheckFileStoreSpaceChange(TFileStoreSpace newSpace, TFileStor
CheckSpaceChanged(FileStoreSpaceHDD, newSpace.HDD, oldSpace.HDD, errStr, "filestore", " (hdd)"));
}

void TPathElement::SetAsyncReplica() {
IsAsyncReplica = true;
void TPathElement::SetAsyncReplica(bool value) {
IsAsyncReplica = value;
}

bool TPathElement::HasRuntimeAttrs() const {
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/schemeshard/schemeshard_path_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ struct TPathElement : TSimpleRefCount<TPathElement> {
void ChangeFileStoreSpaceBegin(TFileStoreSpace newSpace, TFileStoreSpace oldSpace);
void ChangeFileStoreSpaceCommit(TFileStoreSpace newSpace, TFileStoreSpace oldSpace);
bool CheckFileStoreSpaceChange(TFileStoreSpace newSpace, TFileStoreSpace oldSpace, TString& errStr);
void SetAsyncReplica();
void SetAsyncReplica(bool value);
bool HasRuntimeAttrs() const;
void SerializeRuntimeAttrs(google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TUserAttribute>* userAttrs) const;
};
Expand Down
1 change: 1 addition & 0 deletions ydb/core/tx/schemeshard/ut_replication/ut_replication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ Y_UNIT_TEST_SUITE(TReplicationTests) {

TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"), {
NLs::ReplicationMode(NKikimrSchemeOp::TTableReplicationConfig::REPLICATION_MODE_NONE),
NLs::UserAttrsEqual({}),
});
}

Expand Down

0 comments on commit 7bc58fd

Please sign in to comment.