Application settings should avoid serializing Rails-specific data
It seems that when we use Rails.cache
to cache application settings, we also store Rails-specific stuff (https://gitlab.com/gitlab-org/gitlab-ce/issues/38186):
redis /var/opt/gitlab/redis/redis.socket> get "cache:gitlab:application_setting.last"
"\x04\bo: ActiveSupport::Cache::Entry\b:\x0b@valueo:\x17ApplicationSetting\x10:\x10@attributeso:\x1fActiveRecord::AttributeSet\x06;\bo:$ActiveRecord::LazyAttributeHash\n:\x0b@types}{I\"\aid\x06:\x06ETo:?ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer\t:\x0f@precision0:\x0b@scale0:\x0b@limit0:\x0b@rangeo:\nRange\b:\texclT:\nbeginl-\a\x00\x00\x00\x80:\bendl+\a\x00\x00\x00\x80I\"\x1bdefault_projects_limit\x06;\x0cT@\x0bI\"\x13signup_enabled\x06;\x0cTo: ActiveRec
<snip>
If users switch from PostgreSQL to MySQL, they may have to expire this key manually via Redis since the Rake task may fail.
It seems we may want to store the attributes as JSON.
Edited by Stan Hu