I am unable to create indexes on Cloud Spanner tables, receiving the error, "Spanner operation failed".
Even after increasing the cluster size to from 6 to 16 nodes, I am unable to create two indexes on a ~12 million row table.
What I did:
objects
table in Spanner on 3-node clusterSTRING
, INT64
, and one ARRAY<STRING>
object_id
) and object_id
What I tried:
UNIQUE
on single STRING
column)UNIQUE NULL_FILTERED
on single STRING
columns) -- received "Spanner operation failed"UNIQUE NULL_FILTERED
on single STRING
columns) -- received "Spanner operation failed"What else I tried (updated):
NULL_FILTERED
clauses and tried to build other two indexes. Did not resolve, still unable to build.Response from GCS:
Our product team was able to find the reason the indexes are not able to be created. As it appears, within the data, you have two entries that are not unique and thus creates a uniqueness violation[1] and prevent the index from being created. This error is thrown prior to the index attempt and that is why the index creation fails before it is even attempted.
You can use a query to find the duplicate entries:
SELECT column, count(column)
FROM table
GROUP BY column
HAVING COUNT(column) > 1
You can modify this query to search all keys at the same time or modify it after each search. Once the duplicates have been taken care of, you should be able to manage these entries and run the index creation again.
I hope the Spanner team can fix this bug and return the correct error in a future release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With