-
Notifications
You must be signed in to change notification settings - Fork 638
Copy table with sequences and backup without NextVal #2285
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9b4f2e4
Initial commit
shnikd 0a02e8c
Fix copy table
shnikd f0e6704
Fixes
shnikd 7ed714b
Fixes
shnikd 5a8e755
Fixes
shnikd ac8db1c
Fixes
shnikd 2a20f97
Fixes
shnikd 136c803
Fixes
shnikd 26a04bb
Fixes
shnikd 0dc9287
Fixes
shnikd 9c1a586
Fixes
shnikd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose( | |
} | ||
|
||
auto& modifyScheme = *record.AddTransaction(); | ||
modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable); | ||
modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateIndexedTable); | ||
modifyScheme.SetInternal(true); | ||
|
||
const TPath domainPath = TPath::Init(importInfo->DomainPathId, ss); | ||
|
@@ -37,15 +37,51 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose( | |
|
||
modifyScheme.SetWorkingDir(wdAndPath.first); | ||
|
||
auto& tableDesc = *modifyScheme.MutableCreateTable(); | ||
auto* indexedTable = modifyScheme.MutableCreateIndexedTable(); | ||
auto& tableDesc = *(indexedTable->MutableTableDescription()); | ||
tableDesc.SetName(wdAndPath.second); | ||
|
||
Y_ABORT_UNLESS(ss->TableProfilesLoaded); | ||
Ydb::StatusIds::StatusCode status; | ||
if (!FillTableDescription(modifyScheme, item.Scheme, ss->TableProfiles, status, error)) { | ||
if (!FillTableDescription(modifyScheme, item.Scheme, ss->TableProfiles, status, error, true)) { | ||
return nullptr; | ||
} | ||
|
||
for(const auto& column: item.Scheme.columns()) { | ||
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. Это нужно унести в core/ydb_convert. |
||
switch (column.default_value_case()) { | ||
case Ydb::Table::ColumnMeta::kFromSequence: { | ||
const auto& fromSequence = column.from_sequence(); | ||
|
||
auto seqDesc = indexedTable->MutableSequenceDescription()->Add(); | ||
seqDesc->SetName(fromSequence.name()); | ||
if (fromSequence.has_min_value()) { | ||
seqDesc->SetMinValue(fromSequence.min_value()); | ||
} | ||
if (fromSequence.has_max_value()) { | ||
seqDesc->SetMaxValue(fromSequence.max_value()); | ||
} | ||
if (fromSequence.has_start_value()) { | ||
seqDesc->SetStartValue(fromSequence.start_value()); | ||
} | ||
if (fromSequence.has_cache()) { | ||
seqDesc->SetCache(fromSequence.cache()); | ||
} | ||
if (fromSequence.has_increment()) { | ||
seqDesc->SetIncrement(fromSequence.increment()); | ||
} | ||
if (fromSequence.has_cycle()) { | ||
seqDesc->SetCycle(fromSequence.cycle()); | ||
} | ||
|
||
break; | ||
} | ||
case Ydb::Table::ColumnMeta::kFromLiteral: { | ||
break; | ||
} | ||
default: break; | ||
} | ||
} | ||
|
||
return propose; | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -923,6 +923,23 @@ const TPath::TChecker& TPath::TChecker::NotChildren(EStatus status) const { | |
<< ", children: " << childrenCount); | ||
} | ||
|
||
const TPath::TChecker& TPath::TChecker::CanBackupTable(EStatus status) const { | ||
if (Failed) { | ||
return *this; | ||
} | ||
|
||
for (const auto& child: Path.Base()->GetChildren()) { | ||
auto name = child.first; | ||
|
||
TPath childPath = Path.Child(name); | ||
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.
|
||
if (childPath->IsTableIndex()) { | ||
return Fail(status, TStringBuilder() << "path has indexes, request doesn't accept it"); | ||
} | ||
} | ||
|
||
return *this; | ||
} | ||
|
||
const TPath::TChecker& TPath::TChecker::NotDeleted(EStatus status) const { | ||
if (Failed) { | ||
return *this; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Не очень понял, почему понадобилось это изменение?