mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Fix detaching parts with projections
This commit is contained in:
parent
1f9b542ee9
commit
8dbc7a8dae
@ -1323,9 +1323,7 @@ void IMergeTreeDataPart::renameToDetached(const String & prefix) const
|
||||
void IMergeTreeDataPart::makeCloneInDetached(const String & prefix, const StorageMetadataPtr & /*metadata_snapshot*/) const
|
||||
{
|
||||
String destination_path = fs::path(storage.relative_data_path) / getRelativePathForDetachedPart(prefix);
|
||||
|
||||
/// Backup is not recursive (max_level is 0), so do not copy inner directories
|
||||
localBackup(volume->getDisk(), getFullRelativePath(), destination_path, 0);
|
||||
localBackup(volume->getDisk(), getFullRelativePath(), destination_path);
|
||||
volume->getDisk()->removeFileIfExists(fs::path(destination_path) / DELETE_ON_DESTROY_MARKER_FILE_NAME);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
15
tests/queries/0_stateless/01710_projection_detach_part.sql
Normal file
15
tests/queries/0_stateless/01710_projection_detach_part.sql
Normal file
@ -0,0 +1,15 @@
|
||||
set allow_experimental_projection_optimization = 1;
|
||||
|
||||
drop table if exists t;
|
||||
|
||||
create table t (i int, j int, projection x (select * order by j)) engine MergeTree partition by i order by i;
|
||||
|
||||
insert into t values (1, 2);
|
||||
|
||||
alter table t detach partition 1;
|
||||
|
||||
alter table t attach partition 1;
|
||||
|
||||
select count() from system.projection_parts where database = currentDatabase() and table = 't';
|
||||
|
||||
drop table t;
|
Loading…
Reference in New Issue
Block a user