Skip to content

Error enabling DynamoDB table stream #1000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
acunabit opened this issue Oct 1, 2021 · 6 comments
Closed

Error enabling DynamoDB table stream #1000

acunabit opened this issue Oct 1, 2021 · 6 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. service/dynamodb Indicates issues or PRs that are related to dynamodb-controller.

Comments

@acunabit
Copy link

acunabit commented Oct 1, 2021

Describe the bug

The table gets created successfully with streams enabled, however I'm seeing this error in the controller logs:

ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 2021-10-01T02:33:00.423Z	ERROR	controller-runtime.controller	Reconciler error	{"controller": "table", "request": "core/acktable", "error": "ValidationException: Table already has an enabled stream: TableName: acktable\n\tstatus code: 400, request id: VO65U3696SD3C7LO8NFGJ84DP3VV4KQNSO5AEMVJF66Q9ASUAAJG"}

Steps to reproduce

cat  <<EOF | kubectl apply -f -
apiVersion: dynamodb.services.k8s.aws/v1alpha1
kind: Table
metadata:
  namespace: core
  name: acktable
spec:
  tableName: acktable
  billingMode: PAY_PER_REQUEST
  attributeDefinitions:
    - attributeName: ForumName
      attributeType: S
    - attributeName: Subject
      attributeType: S
  keySchema:
    - attributeName: ForumName
      keyType: HASH
    - attributeName: Subject
      keyType: RANGE
  streamSpecification:
    streamEnabled: true
    streamViewType: NEW_AND_OLD_IMAGES
EOF

Then I see this error in the dynamodb controller logs:

ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 2021-10-01T02:42:37.001Z	DEBUG	ackrt	< r.Sync	{"kind": "Table", "namespace": "core", "name": "acktable", "generation": 1, "account": "723236915308", "role": "", "region": "ap-southeast-2", "is_adopted": false, "kind": "Table", "namespace": "core", "name": "acktable", "generation": 1}
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 2021-10-01T02:42:37.001Z	ERROR	controller-runtime.controller	Reconciler error	{"controller": "table", "request": "core/acktable", "error": "ValidationException: Table already has an enabled stream: TableName: acktable\n\tstatus code: 400, request id: DG9S2J8KQHI5PDCPL6QRCE4UB7VV4KQNSO5AEMVJF66Q9ASUAAJG"}
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller github.com/go-logr/zapr.(*zapLogger).Error
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 	/go/pkg/mod/github.com/go-logr/[email protected]/zapr.go:128
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:258
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:232
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:211
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:155
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller k8s.io/apimachinery/pkg/util/wait.BackoffUntil
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:156
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller k8s.io/apimachinery/pkg/util/wait.JitterUntil
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:133
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller k8s.io/apimachinery/pkg/util/wait.Until
ack-dynamodb-controller-5bf84dcdbc-2xnvl controller 	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:90

Expected outcome
Table gets created successfully with streams enabled without seeing any errors in the logs.

Environment

  • Kubernetes version
    1.19
  • Using EKS (yes/no), if so version?
  • yes : eks.6
  • AWS service targeted (S3, RDS, etc.)
  • Dynamodb
@acunabit acunabit added the kind/bug Categorizes issue or PR as related to a bug. label Oct 1, 2021
@jaypipes
Copy link
Collaborator

jaypipes commented Oct 1, 2021

@a-hilaly please look into this one.

Couple things immediately stand out for me:

  • There should not be stacktraces in the log output. a ValidationException is a "normal" error/fault code and should be dealt with in the normal flow of code (not make an ERROR log...). ValidationException perhaps should be listed in terminal conditions for the Table resource?
  • This looks to be a situation where the Delta is erroneously picking up a need to change the streamSpecification even though it has not changed. Maybe look into whether that's happening and add an e2e test for it?

@ack-bot
Copy link
Collaborator

ack-bot commented Apr 28, 2022

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle stale

@ack-bot ack-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 28, 2022
@a-hilaly
Copy link
Member

/lifecycle frozen

@ack-bot ack-bot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 28, 2022
@a-hilaly a-hilaly added service/dynamodb Indicates issues or PRs that are related to dynamodb-controller. and removed DynamoDB labels Dec 13, 2022
@jljaco jljaco added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Mar 30, 2023
ack-prow bot pushed a commit to aws-controllers-k8s/dynamodb-controller that referenced this issue Apr 6, 2023
Issues:

- aws-controllers-k8s/community#1000
- aws-controllers-k8s/community#1029
- aws-controllers-k8s/community#1596

Description of changes:
- Add `Table` custom update code
- Add `Table` custom preCompare delta code (to properly compare
`GlobalSecondaryIndexes` ,`AttributeDefinitions` and `KeySchemas`)
- Add unit tests for custom compare code for `GlobalSecondaryIndexes`
- Make `KeySchema` an immutable field.
- Gradually update `GlobalSecondaryIndexes` when multiple ones are
update/removed or added.
- Add custom code to properly populate `BillingMode` and
`SSESpecification` and `TableClass`
- Add e2e tests for each new support field update + one test to ensure
  that multi-field updates at once can be properly handled

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
@a-hilaly
Copy link
Member

a-hilaly commented Apr 6, 2023

Fixed and released in dynamodb v1.1.0
/close

@ack-prow ack-prow bot closed this as completed Apr 6, 2023
@ack-prow
Copy link

ack-prow bot commented Apr 6, 2023

@a-hilaly: Closing this issue.

In response to this:

Fixed and released in dynamodb v1.1.0
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@a-hilaly
Copy link
Member

a-hilaly commented Apr 6, 2023

/cc @acunabit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. service/dynamodb Indicates issues or PRs that are related to dynamodb-controller.
Projects
No open projects
Status: Done
Development

No branches or pull requests

7 participants