Skip to content

Commit

Permalink
Do not call "PersistACL" after "PersistPath". PersistPath stores acl. (
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherednik authored Apr 25, 2024
1 parent eebd1ab commit 3341a32
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 41 deletions.
3 changes: 1 addition & 2 deletions ydb/core/tx/schemeshard/olap/operations/create_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,11 @@ class TCreateOlapStore: public TSubOperation {
context.OnComplete.ActivateTx(OperationId);

context.SS->PersistTxState(db, OperationId);
context.SS->PersistPath(db, dstPath.Base()->PathId);

if (!acl.empty()) {
dstPath.Base()->ApplyACL(acl);
context.SS->PersistACL(db, dstPath.Base());
}
context.SS->PersistPath(db, dstPath.Base()->PathId);

context.SS->PersistUpdateNextPathId(db);
context.SS->PersistUpdateNextShardIdx(db);
Expand Down
3 changes: 1 addition & 2 deletions ydb/core/tx/schemeshard/olap/operations/create_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,14 +812,13 @@ class TCreateColumnTable: public TSubOperation {

NIceDb::TNiceDb db(context.GetDB());
context.SS->PersistTxState(db, OperationId);
context.SS->PersistPath(db, dstPath.Base()->PathId);

context.OnComplete.ActivateTx(OperationId);

if (!acl.empty()) {
dstPath.Base()->ApplyACL(acl);
context.SS->PersistACL(db, dstPath.Base());
}
context.SS->PersistPath(db, dstPath.Base()->PathId);

context.SS->PersistUpdateNextPathId(db);
context.SS->PersistUpdateNextShardIdx(db);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,11 @@ class TAllocatePQ: public TSubOperation {
context.OnComplete.ActivateTx(OperationId);

context.SS->PersistTxState(db, OperationId);
context.SS->PersistPath(db, dstPath.Base()->PathId);

if (!acl.empty()) {
dstPath.Base()->ApplyACL(acl);
context.SS->PersistACL(db, dstPath.Base());
}
context.SS->PersistPath(db, dstPath.Base()->PathId);

context.SS->PersistUpdateNextPathId(db);
context.SS->PersistUpdateNextShardIdx(db);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,11 @@ class TAlterExternalDataSource : public TSubOperation {
const auto& externalDataSourcePathId = externalDataSourcePath->PathId;

context.SS->ExternalDataSources[externalDataSourcePathId] = externalDataSourceInfo;
context.SS->PersistPath(db, externalDataSourcePathId);

if (!acl.empty()) {
externalDataSourcePath->ApplyACL(acl);
context.SS->PersistACL(db, externalDataSourcePath);
}
context.SS->PersistPath(db, externalDataSourcePathId);

context.SS->PersistExternalDataSource(db,
externalDataSourcePathId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,11 @@ class TAlterExternalTable: public TSubOperation {
bool isSameDataSource) const {
context.SS->ExternalTables[externalTable->PathId] = externalTableInfo;

context.SS->PersistPath(db, externalTable->PathId);

if (!acl.empty()) {
externalTable->ApplyACL(acl);
context.SS->PersistACL(db, externalTable);
}
context.SS->PersistPath(db, externalTable->PathId);

if (!isSameDataSource) {
context.SS->PersistExternalDataSource(db, externalDataSourcePathId, externalDataSource);
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ namespace NKikimr::NSchemeShard {
context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
context.OnComplete.ActivateTx(OperationId);

context.SS->PersistPath(db, dstPath->PathId);
if (!acl.empty()) {
dstPath->ApplyACL(acl);
context.SS->PersistACL(db, dstPath.Base());
}
context.SS->PersistPath(db, dstPath->PathId);

context.SS->BlobDepots[pathId] = blobDepot;
context.SS->PersistBlobDepot(db, pathId, *blobDepot);
context.SS->IncrementPathDbRefCount(pathId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,10 @@ class TCopySequence: public TSubOperation {
context.SS->ChangeTxState(db, OperationId, txState.State);
context.OnComplete.ActivateTx(OperationId);

context.SS->PersistPath(db, dstPath->PathId);
if (!acl.empty()) {
dstPath->ApplyACL(acl);
context.SS->PersistACL(db, dstPath.Base());
}
context.SS->PersistPath(db, dstPath->PathId);

context.SS->Sequences[pathId] = sequenceInfo;
context.SS->PersistSequence(db, pathId, *sequenceInfo);
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ TTxState& PrepareChanges(TOperationId operationId, TPathElement::TPtr parentDir,
context.SS->ChangeTxState(db, operationId, TTxState::CreateParts);
context.OnComplete.ActivateTx(operationId);

context.SS->PersistPath(db, volumePath->PathId);
if (!acl.empty()) {
volumePath->ApplyACL(acl);
context.SS->PersistACL(db, volumePath);
}
context.SS->PersistPath(db, volumePath->PathId);

for (auto& shard : volume->Shards) {
auto shardIdx = shard.first;
const auto& part = shard.second;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,11 @@ class TCreateExternalDataSource : public TSubOperation {

context.SS->ExternalDataSources[externalDataSourcePathId] = externalDataSourceInfo;
context.SS->IncrementPathDbRefCount(externalDataSourcePathId);
context.SS->PersistPath(db, externalDataSourcePathId);

if (!acl.empty()) {
externalDataSourcePath->ApplyACL(acl);
context.SS->PersistACL(db, externalDataSourcePath);
}
context.SS->PersistPath(db, externalDataSourcePathId);

context.SS->PersistExternalDataSource(db,
externalDataSourcePathId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,11 @@ class TCreateExternalTable: public TSubOperation {
context.SS->ExternalTables[externalTable->PathId] = externalTableInfo;
context.SS->IncrementPathDbRefCount(externalTable->PathId);

context.SS->PersistPath(db, externalTable->PathId);

if (!acl.empty()) {
externalTable->ApplyACL(acl);
context.SS->PersistACL(db, externalTable);
}
context.SS->PersistPath(db, externalTable->PathId);

context.SS->PersistExternalDataSource(db, externalDataSourcePathId, externalDataSource);
context.SS->PersistExternalTable(db, externalTable->PathId, externalTableInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,12 @@ class TCreateExtSubDomain: public TSubOperation {

NIceDb::TNiceDb db(context.GetDB());

context.SS->PersistPath(db, newNode->PathId);
context.SS->ApplyAndPersistUserAttrs(db, newNode->PathId);

if (!acl.empty()) {
newNode->ApplyACL(acl);
context.SS->PersistACL(db, newNode);
}
context.SS->PersistPath(db, newNode->PathId);

context.SS->PersistUpdateNextPathId(db);

Expand Down
3 changes: 1 addition & 2 deletions ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,10 @@ TTxState& TCreateFileStore::PrepareChanges(
context.SS->ChangeTxState(db, operationId, TTxState::CreateParts);
context.OnComplete.ActivateTx(operationId);

context.SS->PersistPath(db, fsPath->PathId);
if (!acl.empty()) {
fsPath->ApplyACL(acl);
context.SS->PersistACL(db, fsPath);
}
context.SS->PersistPath(db, fsPath->PathId);

context.SS->FileStoreInfos[pathId] = fs;
context.SS->PersistFileStoreInfo(db, pathId, fs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ TTxState& PrepareChanges(TOperationId operationId, TPathElement::TPtr parentDir,
context.SS->ChangeTxState(db, operationId, TTxState::CreateParts);
context.OnComplete.ActivateTx(operationId);

context.SS->PersistPath(db, item->PathId);
if (!acl.empty()) {
item->ApplyACL(acl);
context.SS->PersistACL(db, item);
}
context.SS->PersistPath(db, item->PathId);
context.SS->KesusInfos[pathId] = kesus;
context.SS->PersistKesusInfo(db, pathId, kesus);
context.SS->IncrementPathDbRefCount(pathId);
Expand Down
3 changes: 1 addition & 2 deletions ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,11 @@ class TCreatePQ: public TSubOperation {

context.SS->PersistTxState(db, OperationId);

context.SS->PersistPath(db, dstPath.Base()->PathId);

if (!acl.empty()) {
dstPath.Base()->ApplyACL(acl);
context.SS->PersistACL(db, dstPath.Base());
}
context.SS->PersistPath(db, dstPath.Base()->PathId);

context.SS->PersistUpdateNextPathId(db);
context.SS->PersistUpdateNextShardIdx(db);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,10 @@ class TCreateReplication: public TSubOperation {

NIceDb::TNiceDb db(context.GetDB());

context.SS->PersistPath(db, path->PathId);
if (!acl.empty()) {
path->ApplyACL(acl);
context.SS->PersistACL(db, path.Base());
}
context.SS->PersistPath(db, path->PathId);

context.SS->PersistReplication(db, path->PathId, *replication);
context.SS->PersistReplicationAlter(db, path->PathId, *replication->AlterData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,11 @@ class TCreateRTMR: public TSubOperation {
context.SS->TabletCounters->Simple()[COUNTER_RTMR_PARTITIONS_COUNT].Add(rtmrVolumeInfo->Partitions.size());
context.SS->IncrementPathDbRefCount(newRtmrVolume->PathId);

context.SS->PersistPath(db, newRtmrVolume->PathId);

if (!acl.empty()) {
newRtmrVolume->ApplyACL(acl);
context.SS->PersistACL(db, newRtmrVolume);
}
context.SS->PersistPath(db, newRtmrVolume->PathId);

context.SS->PersistRtmrVolume(db, newRtmrVolume->PathId, rtmrVolumeInfo);
context.SS->PersistTxState(db, OperationId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,10 @@ class TCreateSequence : public TSubOperation {
context.SS->ChangeTxState(db, OperationId, txState.State);
context.OnComplete.ActivateTx(OperationId);

context.SS->PersistPath(db, dstPath->PathId);
if (!acl.empty()) {
dstPath->ApplyACL(acl);
context.SS->PersistACL(db, dstPath.Base());
}
context.SS->PersistPath(db, dstPath->PathId);

context.SS->Sequences[pathId] = sequenceInfo;
context.SS->PersistSequence(db, pathId, *sequenceInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,11 @@ class TCreateSolomon: public TSubOperation {

context.SS->PersistTxState(db, OperationId);

context.SS->PersistPath(db, newSolomon->PathId);

if (!acl.empty()) {
newSolomon->ApplyACL(acl);
context.SS->PersistACL(db, newSolomon);
}
context.SS->PersistPath(db, newSolomon->PathId);

context.SS->PersistUpdateNextPathId(db);
context.SS->PersistUpdateNextShardIdx(db);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,12 @@ class TCreateSubDomain: public TSubOperation {

NIceDb::TNiceDb db(context.GetDB());

context.SS->PersistPath(db, newNode->PathId);
context.SS->ApplyAndPersistUserAttrs(db, newNode->PathId);

if (!acl.empty()) {
newNode->ApplyACL(acl);
context.SS->PersistACL(db, newNode);
}
context.SS->PersistPath(db, newNode->PathId);

context.SS->PersistUpdateNextPathId(db);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,13 +666,12 @@ class TCreateTable: public TSubOperation {
context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
context.OnComplete.ActivateTx(OperationId);

context.SS->PersistPath(db, newTable->PathId);
context.SS->ApplyAndPersistUserAttrs(db, newTable->PathId);

if (!acl.empty()) {
newTable->ApplyACL(acl);
context.SS->PersistACL(db, newTable);
}
context.SS->PersistPath(db, newTable->PathId);
context.SS->PersistTable(db, newTable->PathId);
context.SS->PersistTxState(db, OperationId);

Expand Down

0 comments on commit 3341a32

Please sign in to comment.