How to reproduce (this is the part of 01526_alter_add_and_modify_order_zookeeper test):

```sql
CREATE TABLE table_for_alter
(
    `d` Date,
    `a` String,
    `b` UInt8,
    `x` String,
    `y` Int8,
    `version` UInt64,
    `sign` Int8 DEFAULT 1
)
ENGINE = ReplicatedVersionedCollapsingMergeTree('/clickhouse/tables/01526_alter_add/t4', '1', sign, version)
PARTITION BY y
ORDER BY d
SETTINGS index_granularity = 8192;

INSERT INTO table_for_alter VALUES(toDate('2019-10-01'), 'a', 1, 'aa', 1, 1, 1);

ALTER TABLE table_for_alter ADD COLUMN order UInt32, MODIFY ORDER BY (d, order);
```

After restarting server it fails with the error:
```
<Error> Application: DB::Exception: Existing table metadata in ZooKeeper differs in sorting key expression. Stored in ZooKeeper: d, order, local: d, order, version: Cannot attach table `default`.`table_for_alter` from metadata file /home/avogar/ClickHouse/programs/server/store/379/3795dcee-cc60-41ab-b795-dceecc6001ab/table_for_alter.sql from query ATTACH TABLE default.table_for_alter UUID 'b7e7470c-6fcb-4a95-b7e7-470c6fcbda95' (`d` Date, `a` String, `b` UInt8, `x` String, `y` Int8, `version` UInt64, `sign` Int8 DEFAULT 1, `order` UInt32) ENGINE = ReplicatedVersionedCollapsingMergeTree('/clickhouse/tables/01526_alter_add/t4', '1', sign, version) PARTITION BY y PRIMARY KEY d ORDER BY (d, order) SETTINGS index_granularity = 8192: while loading database `default` from path ./metadata/default
```
{
    if (data.format_version < MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING)
    {
        auto minmax_idx_column_names = data.getMinMaxColumnsNames(metadata_snapshot->getPartitionKey());
        date_column = minmax_idx_column_names[data.minmax_idx_date_column_pos];
    }
    const auto data_settings = data.getSettings();
    sampling_expression = formattedAST(metadata_snapshot->getSamplingKeyAST());
    index_granularity = data_settings->index_granularity;
    merging_params_mode = static_cast<int>(data.merging_params.mode);
    sign_column = data.merging_params.sign_column;
    
    
    
    
    
    
    primary_key = formattedAST(metadata_snapshot->getPrimaryKey().expression_list_ast);
    if (metadata_snapshot->isPrimaryKeyDefined())
        sorting_key = formattedAST(metadata_snapshot->getSortingKey().expression_list_ast);
    data_format_version = data.format_version;
    if (data.format_version >= MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING)
        partition_key = formattedAST(metadata_snapshot->getPartitionKey().expression_list_ast);
    ttl_table = formattedAST(metadata_snapshot->getTableTTLs().definition_ast);
    skip_indices = metadata_snapshot->getSecondaryIndices().toString();
    projections = metadata_snapshot->getProjections().toString();
    if (data.canUseAdaptiveGranularity())
        index_granularity_bytes = data_settings->index_granularity_bytes;
    else
        index_granularity_bytes = 0;