-
Sam Bostock authored
Previously, BigDecimal was listed as not needing a serializer. However, when used with an adapter storing the job arguments as JSON, it would get serialized as a simple String, resulting in deserialization also producing a String (instead of a BigDecimal). By using a serializer, we ensure the round trip is safe. During upgrade deployments of applications with multiple replicas making use of BigDecimal job arguments with a queue adapter serializing to JSON, there exists a possible race condition, whereby a "new" replica enqueues a job with an argument serialized using `BigDecimalSerializer`, and an "old" replica fails to deserialize it (as it does not have `BigDecimalSerializer`). Therefore, to ensure safe upgrades, serialization will not use `BigDecimalSerializer` until `config.active_job.use_big_decimal_serializer` is enabled, which can be done safely after successful deployment of Rails 7.1. This option will be removed in Rails 7.2, when it will become the default.
Sam Bostock authoredPreviously, BigDecimal was listed as not needing a serializer. However, when used with an adapter storing the job arguments as JSON, it would get serialized as a simple String, resulting in deserialization also producing a String (instead of a BigDecimal). By using a serializer, we ensure the round trip is safe. During upgrade deployments of applications with multiple replicas making use of BigDecimal job arguments with a queue adapter serializing to JSON, there exists a possible race condition, whereby a "new" replica enqueues a job with an argument serialized using `BigDecimalSerializer`, and an "old" replica fails to deserialize it (as it does not have `BigDecimalSerializer`). Therefore, to ensure safe upgrades, serialization will not use `BigDecimalSerializer` until `config.active_job.use_big_decimal_serializer` is enabled, which can be done safely after successful deployment of Rails 7.1. This option will be removed in Rails 7.2, when it will become the default.
Loading