**How to reproduce**
Clickhouse server 20.13.1.5273
```
CREATE TABLE default.test
(
`key` UInt32,
`ts` DateTime CODEC(DoubleDelta, LZ4),
`db_time` DateTime DEFAULT now() COMMENT 'spout-ignore' CODEC(DoubleDelta, LZ4)
)
ENGINE = MergeTree
PARTITION BY toStartOfTenMinutes(db_time)
ORDER BY (key, ts)
TTL db_time + toIntervalHour(3)
SETTINGS index_granularity = 8192, merge_with_ttl_timeout = 3600, min_rows_for_compact_part = 1000000, min_bytes_for_compact_part = 200000000, in_memory_parts_enable_wal = 0;


INSERT INTO test(key, ts) SELECT number % 1000, now() + intDiv(number,1000) FROM numbers(500);

SELECT * FROM test;
500 rows in set. Elapsed: 0.003 sec.

DETACH TABLE test;

ATTACH TABLE test;

SELECT * FROM test;

0 rows in set. Elapsed: 0.002 sec.
```

**Expected behavior**
Clickhouse would flush parts on disk.
data_path_in_backup,
                             part_name,
                             part_info = std::move(part_info),
                             filenames = std::move(filenames),
                             reservation,
                             increment]()
        {
            auto disk = reservation->getDisk();
            auto temp_part_dir_owner = std::make_shared<TemporaryFileOnDisk>(disk, relative_data_path + "restoring_" + part_name + "_");
            String temp_part_dir = temp_part_dir_owner->getPath();
            disk->createDirectories(temp_part_dir);
            assert(temp_part_dir.starts_with(relative_data_path));
            String relative_temp_part_dir = temp_part_dir.substr(relative_data_path.size());
            for (const String & filename : filenames)
            {
                auto backup_entry = backup->readFile(data_path_in_backup + part_name + "/" + filename);
                auto read_buffer = backup_entry->getReadBuffer();
                auto write_buffer = disk->writeFile(temp_part_dir + "/" + filename);
                copyData(*read_buffer, *write_buffer);
            }
            auto single_disk_volume = std::make_shared<SingleDiskVolume>(disk->getName(), disk, 0);
            auto part = createPart(part_name, *part_info, single_disk_volume, relative_temp_part_dir);
            part->loadColumnsChecksumsIndexes(false, true);
            renameTempPartAndAdd(part, increment);
        };
        restore_tasks.emplace_back(std::move(restore_task));
    }
    return restore_tasks;
}
String MergeTreeData::getPartitionIDFromQuery(const ASTPtr & ast, ContextPtr local_context) const