Skip to content

Commit 099dbf8

Browse files
authored
make tableReplica a no-op field (#124)
Previously, we released a new patch version of dynamodb that introduced a new field called tableReplicas. It turns out that updating to this change could trigger accidental deletion of table replicas that were previously/manually created or managed with different tools (such as CDK/CF). To smoothen the upgrade process, we propose to revert this change in a patch release, and re-introduce tableReplicas in a minor one, aligning more with semantic versioning standards and signaling to ACK users that a significant feature has been introduced so that they can read the change log and take the necessary actions. We also propose that we create a standard/process around versioning, ideally new fields needs to be introduced in minor releases, patches should only include bug fixes and non-break behavior changes. Description of changes: - removing tableReplica hooks , will be included with a minor release. - `tableReplica` field remains as a no-op field By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 11a5690 commit 099dbf8

File tree

7 files changed

+22
-981
lines changed

7 files changed

+22
-981
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ack_generate_info:
2-
build_date: "2025-03-24T15:20:40Z"
2+
build_date: "2025-03-27T18:00:37Z"
33
build_hash: 3722729cebe6d3c03c7e442655ef0846f91566a2
4-
go_version: go1.24.0
4+
go_version: go1.24.1
55
version: v0.43.2-7-g3722729
66
api_directory_checksum: cb49386ebd7bb50e2521072a76262c72b9dbd285
77
api_version: v1alpha1

pkg/resource/table/hooks.go

+19-20
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ package table
1515

1616
import (
1717
"context"
18-
"errors"
1918
"fmt"
2019
"strings"
2120
"time"
@@ -233,17 +232,17 @@ func (rm *resourceManager) customUpdateTable(
233232
}
234233
return nil, err
235234
}
236-
case delta.DifferentAt("Spec.TableReplicas"):
237-
// Enabling replicas required streams enabled and StreamViewType to be NEW_AND_OLD_IMAGES
238-
// Version 2019.11.21 TableUpdate API requirement
239-
if !hasStreamSpecificationWithNewAndOldImages(desired) {
240-
msg := "table must have DynamoDB Streams enabled with StreamViewType set to NEW_AND_OLD_IMAGES for replica updates"
241-
rlog.Debug(msg)
242-
return nil, ackerr.NewTerminalError(errors.New(msg))
243-
}
244-
if err := rm.syncReplicas(ctx, latest, desired); err != nil {
245-
return nil, err
246-
}
235+
// case delta.DifferentAt("Spec.TableReplicas"):
236+
// // Enabling replicas required streams enabled and StreamViewType to be NEW_AND_OLD_IMAGES
237+
// // Version 2019.11.21 TableUpdate API requirement
238+
// if !hasStreamSpecificationWithNewAndOldImages(desired) {
239+
// msg := "table must have DynamoDB Streams enabled with StreamViewType set to NEW_AND_OLD_IMAGES for replica updates"
240+
// rlog.Debug(msg)
241+
// return nil, ackerr.NewTerminalError(errors.New(msg))
242+
// }
243+
// if err := rm.syncReplicas(ctx, latest, desired); err != nil {
244+
// return nil, err
245+
// }
247246
}
248247
}
249248

@@ -578,14 +577,14 @@ func customPreCompare(
578577
}
579578
}
580579

581-
// Handle ReplicaUpdates API comparison
582-
if len(a.ko.Spec.TableReplicas) != len(b.ko.Spec.TableReplicas) {
583-
delta.Add("Spec.TableReplicas", a.ko.Spec.TableReplicas, b.ko.Spec.TableReplicas)
584-
} else if a.ko.Spec.TableReplicas != nil && b.ko.Spec.TableReplicas != nil {
585-
if !equalReplicaArrays(a.ko.Spec.TableReplicas, b.ko.Spec.TableReplicas) {
586-
delta.Add("Spec.TableReplicas", a.ko.Spec.TableReplicas, b.ko.Spec.TableReplicas)
587-
}
588-
}
580+
// // Handle ReplicaUpdates API comparison
581+
// if len(a.ko.Spec.TableReplicas) != len(b.ko.Spec.TableReplicas) {
582+
// delta.Add("Spec.TableReplicas", a.ko.Spec.TableReplicas, b.ko.Spec.TableReplicas)
583+
// } else if a.ko.Spec.TableReplicas != nil && b.ko.Spec.TableReplicas != nil {
584+
// if !equalReplicaArrays(a.ko.Spec.TableReplicas, b.ko.Spec.TableReplicas) {
585+
// delta.Add("Spec.TableReplicas", a.ko.Spec.TableReplicas, b.ko.Spec.TableReplicas)
586+
// }
587+
// }
589588

590589
if a.ko.Spec.DeletionProtectionEnabled == nil {
591590
a.ko.Spec.DeletionProtectionEnabled = aws.Bool(false)

0 commit comments

Comments
 (0)