question

Yury avatar image
Yury asked Erick Ramirez commented

Is it possible to ignore consistency level ALL when truncating a table in multi DC cluster?

Is it possible to ignore consistency level ALL when truncating a table in multi DC cluster?

For example, when a remote data-center is down and a local DC is up - we can't run data-migration script (that truncates some table) because of the remote DC. Getting this error:

Error during truncate: Cannot achieve consistency level ALL

Perhaps we are missing something in our cluster setup..

Thanks!

consistency leveltruncate
10 |1000

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

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez commented

All nodes must be available when truncating a table because by definition, it's an immediate removal of data from the table at a point in time.

If nodes do not receive the truncation request because they are down or unresponsive, the data on these nodes do not get removed. When they rejoin the cluster or become responsive again, they will return data you thought was already deleted so it isn't possible to perform a TRUNCATE unless all nodes are available. Cheers!

3 comments 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.

Yury avatar image Yury commented ·
Thanks, that makes sense.
0 Likes 0 ·
Yury avatar image Yury commented ·

@Erick Ramirez Is "TUNCATE" the only command that requires all nodes in the cluster to be available?

I didn't find other commands with similar requirement (in the documentation: https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlCommandsTOC.html)

If so we may consider replacing truncate with delete in our use-case.

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ Yury commented ·

That would be expensive because it requires a full table scan so will affect the performance of your cluster. Cheers!

1 Like 1 ·