Skip to content

DeleteTableOperation uses OperationName.DELETE_ITEM instead of OperationName.DELETE_TABLE #6760

@andreas-grafenberger

Description

@andreas-grafenberger

Describe the bug

When the DynamoDb Enhanced Client executes a delete table request (via DeleteTableOperation), the operation name is mapped to OperationName.DELETE_ITEM instead of OperationName.DELETE_TABLE.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

When the Enhanced Client executes a delete table request (via DeleteTableOperation), the SDK should:

  • Classify the operation as a table delete, i.e., it should use OperationName.DELETE_TABLE (not OperationName.DELETE_ITEM) for the operation metadata/context emitted by the Enhanced Client.
  • As a result, instrumentation/metrics/tracing and any extension hooks that key off OperationName should see this request as a DeleteTable call (a control-plane/table-level operation), not an item-level delete.
  • The underlying service call remains DynamoDB DeleteTable, which deletes the table and all items in it.

Current Behavior

When this method is called: software.amazon.awssdk.enhanced.dynamodb.internal.operations.DeleteTableOperation#operationName(), it returns OperationName.DELETE_ITEM.

Reproduction Steps

You can add a test in services-custom/dynamodb-enhanced/src/test/java/software/amazon/awssdk/enhanced/dynamodb/internal/operations/DeleteTableOperationTest.java:

@Test
public void operationName_returnsDeleteTable() {
    DeleteTableOperation<FakeItemWithIndices> operation = DeleteTableOperation.create();
    assertThat(operation.operationName().label(), is(OperationName.DELETE_TABLE.label()));
}

This test should pass, but is failing now:

java.lang.AssertionError: 
Expected: is "DeleteTable"
     but: was "DeleteItem"
Expected :DeleteTable
Actual   :DeleteItem

Possible Solution

Replacing method: software.amazon.awssdk.enhanced.dynamodb.internal.operations.DeleteTableOperation#operationName()

    @Override
    public OperationName operationName() {
        return OperationName.DELETE_ITEM;
    }

with:

    @Override
    public OperationName operationName() {
        return OperationName.DELETE_TABLE;
    }

Additional Information/Context

No response

AWS Java SDK version used

2.42.4

JDK version used

21

Operating System and version

macOS Tahoe 26.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.dynamodb-enhancedp2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions