```
CREATE TABLE t (x UInt8, PROJECTION p (SELECT x GROUP BY x)) ENGINE = MergeTree ORDER BY ();
INSERT INTO t VALUES (0);

SET group_by_overflow_mode = 'any', max_rows_to_group_by = 1000, totals_mode = 'after_having_auto';
SELECT x FROM t GROUP BY x WITH TOTALS;
```
{
    LOG_TRACE(log, "dropAllData: waiting for locks.");
    auto settings_ptr = getSettings();
    auto lock = lockParts();
    DataPartsVector all_parts;
    for (auto it = data_parts_by_info.begin(); it != data_parts_by_info.end(); ++it)
    {
        modifyPartState(it, DataPartState::Deleting);
        all_parts.push_back(*it);
    }
    {
        std::lock_guard wal_lock(write_ahead_log_mutex);
        if (write_ahead_log)
            write_ahead_log->shutdown();
    }
    
    
    if (!getStorageID().hasUUID())
        getContext()->dropCaches();
    
    NameSet part_names_failed;
    try
    {
        LOG_TRACE(log, "dropAllData: removing data parts (count {}) from filesystem.", all_parts.size());
        clearPartsFromFilesystem(all_parts, true, &part_names_failed);
        LOG_TRACE(log, "dropAllData: removing all data parts from memory.");