Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

suujana.naga16_165607 avatar image
suujana.naga16_165607 asked Erick Ramirez edited

How do we check how much time it took to drop a table?

Please help with couple of questions:

1. How do we check how much time it took to drop a table in cassandra?

2. We do have some huge tables to drop in production and what will be the general impact on the cluster when a table with huge amount of data (1 TB) is dropped with auto_snapshot enabled?

schema
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

steve.lacerda avatar image
steve.lacerda answered

Hi! The drop will not take much time at all. It's basically just a linking of files for the snapshot (and this doesn't depend on the size of the files, but rather on the number of files in the data dir). Then an rm of the sstable files, which is quick as well. You could get an idea of timing if you use cqlsh and turn TRACING ON and then DROP TABLE <tablename>.

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez edited

The time it takes to drop a table isn't recorded so you have to manually time it yourself.

When a table is dropped, the files on disk are hard-linked to a snapshot subdirectory and removed from the original location on each of the nodes in the cluster. The process of taking a snapshot is a low-level filesystem operation and largely depends on the underlying disk/volume. If there are thousands and thousands of files, it will take a while for the operation to complete as the hard-links are created. It's not uncommon for the command to timeout if nodes take a long time to respond back to the coordinator.

Note that since the snapshots are hardlinks to the original file inodes, the space on disk doesn't get freed up automatically. You will need to manually delete the snapshot subdirectory on all the nodes in the cluster to reclaim the disk space. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.