```
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;
```
auto iter = data_parts_by_state_and_info.begin();
    while (iter != data_parts_by_state_and_info.end() && (*iter)->getState() == DataPartState::Active)
    {
        const DataPartPtr & part = *iter;
        part->loadVersionMetadata();
        VersionMetadata & version = part->version;
        if (part->wasInvolvedInTransaction())
        {
            have_parts_with_version_metadata = true;
        }
        else
        {
            ++iter;
            continue;
        }
        
        bool version_updated = false;
        chassert(!version.creation_tid.isEmpty());
        if (!part->version.creation_csn)
        {
            auto min = TransactionLog::getCSN(version.creation_tid);
            if (!min)
            {
                
                TransactionLog::assertTIDIsNotOutdated(version.creation_tid);
                min = Tx::RolledBackCSN;
            }
            LOG_TRACE(log, "Will fix version metadata of {} after unclean restart: part has creation_tid={}, setting creation_csn={}",
                      part->name, version.creation_tid, min);
            version.creation_csn = min;