iTwin / imodel-transformer

API for exporting an iModel's parts and also importing them into another iModel
MIT License
3 stars 2 forks source link

Logs overflowed by SQLite errors #44

Open VikteBaranauskiene opened 1 year ago

VikteBaranauskiene commented 1 year ago

This started happening with increased iTwinJs version.

This was happening when creating a transformation state dump and it has subCategory information. SubCategory information is stored incorrectly within the state dump.

seq

MichaelBelousov commented 1 year ago

Will try to reproduce with this. Does it look correct?

class Repro extends IModelTransformer {
  onExportElement(...args) {
    super.onExportElement(...args);
    if (elem instanceof SubCategory)
      this.saveStateToDb();
  }
}
// run that transformer on a source with a subcategory to an empty target 
ViliusRuskys commented 1 year ago

I noticed similar logs when registering SubCategories for filtering like transformer.context.filterSubCategory(subCategoryId). Then when creating the saved state it spits out a bunch of these error logs.

I also remember checking the saved state with an sqlite explorer, and it seemed that subcategory serialization logic was incorrect. e.g. If you had 10 different SubCategories registered for filtering, in the saved state generated all 10 ids will be identical pointing to the same Element. Don't know if you were aware of this and if this issue is fixed on the current version though.