mz_catalog/durable/upgrade/v94_to_v95.rs
1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10use crate::durable::upgrade::MigrationAction;
11use crate::durable::upgrade::objects_v94 as v94;
12use crate::durable::upgrade::objects_v95 as v95;
13
14/// Adds the ID allocators for the new `ClusterReplicaSize` collection. The
15/// collection itself starts empty and is populated from the
16/// `--cluster-replica-sizes` flag on catalog open.
17pub fn upgrade(
18 _snapshot: Vec<v94::StateUpdateKind>,
19) -> Vec<MigrationAction<v94::StateUpdateKind, v95::StateUpdateKind>> {
20 ["user_cluster_replica_size", "system_cluster_replica_size"]
21 .into_iter()
22 .map(|name| {
23 MigrationAction::Insert(v95::StateUpdateKind::IdAlloc(v95::IdAlloc {
24 key: v95::IdAllocKey {
25 name: name.to_string(),
26 },
27 value: v95::IdAllocValue { next_id: 1 },
28 }))
29 })
30 .collect()
31}