Schema migration - long to String

#1

Hi,

I need to change field type in our model from long to String. After changing filed type in our model and repairing database with doctor, most of our entities is gone. Doctor puts some errors on console:

[51030] Page #466190 entry 5 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613575
[51031] Page #466191 entry 0 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613577
[51032] Page #466191 entry 1 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613579
[51033] Page #466191 entry 2 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613581
[51034] Page #466191 entry 3 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613583

Is this a bug or there is some other way to change field type that I missed in ODB documentation?

#2

Changing a field from long to String should not require any specific action.

Actually such schema changes are not related to the Doctor, and usually you don't have to run the Doctor after the schema change (you may need to run the Doctor if the field is indexed). Every old object should be adjusted automatically when it is loaded using the new scheme.

Following your report, I checked and it seems that the Doctor may produce false alarms after such schema change.

As a workaround you can read and write (after making them dirty) all the instances of that modified type immediately after the change (and before running the Doctor).

ObjectDB Support
#3

The checks in the Doctor that caused identifying objects after field type change as invalid were removed in build 2.4.5_05.

ObjectDB Support
#4

OK, I should mention one thing. This field has an index on it. After migrating schema, explorer was throwing an error about some Map (didn't get screenshot) and there was no schema in the left panel. After repairing from this state with doctor, almost 53k records was gone from database - only about 3k left.

My assumption is, that database schema was migrated, but index left for old values and when trying to rebuild this index, there was something wrong with filed types.

I will try to reproduce this one more time and I will try to migrate schema with removing index from this field first.

#5

You may also try fixing the index with the Doctor of build 2.4.5_05.

ObjectDB Support
#6

Build 2.4.5_05 works correctly. Thanks.

Reply