New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DynamoDB: 'id' key is S-typed but coerced as bytes #5455
Comments
got any working solution to fix it? |
from celery.backends.dynamodb import DynamoDBBackend
DynamoDBBackend.key_t = str fixes it, but this breaks compatibility with the existing IDs |
@ikonst thanks for the bug report. Would it make sense then to handle both formats simultaneously? Just an observation that the code is currently performing additional transformations on the key (for Python 2/3 compatibility reasons), both on put and get operations. I think the best way to make the transition would be to use BatchGetItem API and attempt to retrieve both Task ID formats. |
You probably wouldn't want this behavior by default, since it 2x cost even for new instances. |
@ikonst I see your point, you are right, we need to examine the impact on cost, since it could require more read capacity units. However, with what I am proposing the read request will always return a single item (depending on the Celery version that created the result record), so I think read capacity unit consumption will be the same. How does that sound? |
So a BatchGetItem for two keys will consume two units, or am I reading it wrong? |
@ikonst indeed, this seems to be the case, so my assumption in the previous comment is invalid. |
We can add an option, so that users can enable the key format change, along with a documentation note and a deprecation warning in the code, that will prompt for upgrade. Eventually the setting will be removed and the new key format will become the default. If the additional unit consumption is not a problem, users can enable the backwards compatible query for a short migration period, and then use the new format. How does that sound? |
So there's effectively 3 modes:
Sounds good to me. |
The resulting stored data looks like:
The DynamoDB 'S' type expects a Unicode string. Note the
b''
repr, presumably an effect ofBaseKeyValueStoreBackend.key_t
that defaults toensure_bytes
.The text was updated successfully, but these errors were encountered: