We copy values unchanged as is in bytes representation. Could you please specify what could be done wrong? I see only one possibility: 1. Start cluster with default encoding (This is only the windows case :)). Set some metastorage values with non ASCII chars. 2. Stop it and restart with specifying encoding to different one.
I suppose that this is very rare case. And all that user should do -- just erase metastore. Another variant -- make all users to erase metastore in order to use UTF-8. пн, 20 дек. 2021 г. в 17:59, Andrey Mashenkov <andrey.mashen...@gmail.com>: > Ivan, > > I'm still not sure it is a good idea to upgrade metastorage automatically. > Because we can't detect the correct charset the metastorage was created > with, and > at the same time we can't be sure the current charset is the correct one. > > So, is there any guarantee the metastorage is consistent even if it was > "upgraded" successfully? > > As I see, we just copy metastorage keys to a temporary one in key-by-key > manner... and then do write-back to the original one. > Seems, if smth goes wrong, the user may get both (original and temporary) > stores broken. > > On Mon, Dec 20, 2021 at 5:27 PM Ivan Daschinsky <ivanda...@gmail.com> > wrote: > > > Andrey, I believe that we already have all machinery to do migration > safe. > > See for > > example > > > org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage#init > > and > > > org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage.TmpStorage. > > This machinery was introduced for slightly different task, but we can > reuse > > this for the current purpose. > > > > пн, 20 дек. 2021 г. в 11:53, Mikhail Petrov <pmgheap....@gmail.com>: > > > > > Thank you all for your replies! > > > I got the idea and agreed with it. Based on the results of the > > > discussion, I have filed a ticket [1]. > > > I will try to investigate it. > > > > > > [1] - https://issues.apache.org/jira/browse/IGNITE-16157 > > > > > > On 16.12.2021 20:11, Ivan Daschinsky wrote: > > > > Andrey, agree with you, good point. > > > > > > > > чт, 16 дек. 2021 г., 16:27 Andrey Mashenkov < > > andrey.mashen...@gmail.com > > > >: > > > > > > > >> Guys, > > > >> > > > >> I like the idea with a flag, but for a different purpose. > > > >> I think it is easy to detect the issue (using the flag) when > > > >> metastorage was created on a new version with a fixed charset, or on > > an > > > >> older version with the user-defined default. > > > >> Regarding the flag, we can choose a new strategy forcing UTF-8, or > > > fallback > > > >> to the old one with defaultCharset and print a warning and > > > recommendation > > > >> in log. > > > >> > > > >> Adding any compatibility stuff is absolutely error-prone because if > > you > > > >> fail in the middle of restoring process, you will get broken > > metastorage > > > >> with keys in different charsets. > > > >> At this point, there is no way to detect broken keys anymore. > > > >> > > > > > > > > > -- > > Sincerely yours, Ivan Daschinskiy > > > > > -- > Best regards, > Andrey V. Mashenkov > -- Sincerely yours, Ivan Daschinskiy