When you create a secondary index on a table that has a custom time to live (TTL), Tablestore requires specific table configurations. To resolve this error, either disable data expiration or prohibit row updates.
Error message
ErrorCode: OTSParameterInvalid, ErrorMessage: Don't support allow update operation on table with index and ttl
Cause
A data table with a secondary index must meet one of these conditions:
-
TTL is -1: data never expires.
-
TTL is a custom value and
TableOptions.AllowUpdateisfalse.
This error occurs when the TTL is not -1 and TableOptions.AllowUpdate is not set to false.
Solution
Choose one option based on your requirements.
Option 1: Set TTL to -1 (disable data expiration)
Use this option if your data does not need to expire.
Tablestore console
-
Log on to the Tablestore console and open the target data table.
-
On the Basic Information tab, click Modify Attributes.
-
Set Time to Live to -1 and click OK.
Tablestore SDK
Call the UpdateTable operation and set TableOptions.TimeToLive to -1.
Option 2: Prohibit row updates (keep custom TTL)
Use this option if you need data expiration but can disable row updates.
After you prohibit updates, the UpdateRow operation can no longer modify data in this table.
Tablestore console
-
Log on to the Tablestore console and open the target data table.
-
On the Basic Information tab, click Modify Attributes.
-
Set Allow Updates to No, select the checkbox to acknowledge the risk, and click OK.
Tablestore SDK
Call the UpdateTable operation and set TableOptions.AllowUpdate to false.