Skip to content

[BUG] Deleting a database by its ID throws error even when successful #214

@eric-schneider

Description

@eric-schneider

Describe the bug

Using a database ID with astra db delete command throws an error even though the deletion appears to be successful.

To Reproduce

Delete a database by its ID:

astra db delete f9301c28-a64d-46e7-a14b-3b2a83972213
[INFO]  Deleting Database 'f9301c28-a64d-46e7-a14b-3b2a83972213'
com.dtsx.astra.cli.db.exception.InvalidDatabaseStateException: Database 'f9301c28-a64d-46e7-a14b-3b2a83972213' has been found but operation cannot be processed due to invalid state (TERMINATING) expected (TERMINATED)
	at com.dtsx.astra.cli.db.DbDeleteCmd.execute(DbDeleteCmd.java:60)
	at com.dtsx.astra.cli.core.AbstractConnectedCmd.run(AbstractConnectedCmd.java:62)
	at com.dtsx.astra.cli.AstraCli.run(AstraCli.java:295)
	at com.dtsx.astra.cli.AstraCli.main(AstraCli.java:270)
	at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
[ERROR] UNAVAILABLE: Database 'f9301c28-a64d-46e7-a14b-3b2a83972213' has been found but operation cannot be processed due to invalid state (TERMINATING) expected (TERMINATED)

Using double quotes makes no difference:

astra db delete "96b1b6e3-5288-4cef-8a41-d4f1d36bbfca"
[INFO]  Deleting Database '96b1b6e3-5288-4cef-8a41-d4f1d36bbfca'
com.dtsx.astra.cli.db.exception.InvalidDatabaseStateException: Database '96b1b6e3-5288-4cef-8a41-d4f1d36bbfca' has been found but operation cannot be processed due to invalid state (TERMINATING) expected (TERMINATED)
	at com.dtsx.astra.cli.db.DbDeleteCmd.execute(DbDeleteCmd.java:60)
	at com.dtsx.astra.cli.core.AbstractConnectedCmd.run(AbstractConnectedCmd.java:62)
	at com.dtsx.astra.cli.AstraCli.run(AstraCli.java:295)
	at com.dtsx.astra.cli.AstraCli.main(AstraCli.java:270)
	at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
[ERROR] UNAVAILABLE: Database '96b1b6e3-5288-4cef-8a41-d4f1d36bbfca' has been found but operation cannot be processed due to invalid state (TERMINATING) expected (TERMINATED)

In both cases, the database appears to successfully terminate because I could no longer see them listed in the Astra Portal (though I did not receive an email notification for successful deletion).

Note that the error does not occur when deleting a database by name:

astra db delete my_vector_db
[INFO]  Deleting Database 'my_vector_db'
[OK]    Database my_vector_db has been deleted

In summary, there appears to be two issues:

  1. Using a database ID with astra db delete command throws an error about an invalid state: (TERMINATING) expected (TERMINATED).
  2. The error produces additional Java output.

Expected behavior

astra db delete f9301c28-a64d-46e7-a14b-3b2a83972213
[INFO]  Deleting Database 'f9301c28-a64d-46e7-a14b-3b2a83972213'
[OK]    Database f9301c28-a64d-46e7-a14b-3b2a83972213 has been deleted

Desktop (please complete the following information):

  • OS: macOS 15.1.1
  • Astra CLI: 0.6
  • Java:
    • openjdk version "20.0.1" 2023-04-18
    • OpenJDK Runtime Environment Temurin-20.0.1+9 (build 20.0.1+9)
    • OpenJDK 64-Bit Server VM Temurin-20.0.1+9 (build 20.0.1+9, mixed mode
  • Python: 3.11.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions