objectbox / objectbox/objectbox-java

Upgrading from Objectbox v1.5 to v2.x fails with index on unsupported property

未关闭
#712 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug
主要语言
Java
星标
4.6k
派生
311
PR 合并指标
30 天内没有已合并 PR

描述

Issue Basics

  • ObjectBox version: 1.5 upgrading to 2.x (2.3.4 at time of writing)
  • Reproducibility: always

Reproducing the bug

Create project with objectbox v1.5, define Object with Entity.

@Entity
public class Foo {
@Index private Double Lat;
@Index private Double Lng;
}

Compile and run project, in order to create the objectbox DB and save some instances.

Update the objectbox version in the project to 2.3.4, then update the entity by removing the @Index annotations

Update the entity to
@Entity
public class Foo {
private Double Lat;
private Double Lng;
}

Recompile and run project again. You will get the following Exception:

io.objectbox.exception.DbException: Indexing of float and double is currently unavailable. Please remove the index on Property Lat (5, Double)

Description

This bug has been already mentioned and discussed in the StackOverflow Thread https://stackoverflow.com/questions/54149954/double-field-index-problem-when-upgrading-objectbox-library

Upgrading the objectbox instance from 1.5 to 2.x when having an @Index set on a Double field is impossible for existing apps.

A desired way of handling this would be to remove the @Index from the existing legacy data structure internally and let the app keep the data as before, making a migration to the new objectbox version possible and seamless.

Please fix this issue as an upgrade of the module is impossible.

Code

ObjectBox v1.5

@Entity
public class Foo {
@Index private Double Lat;
@Index private Double Lng;
}

ObjectBox v2.3.4
@Entity
public class Foo {
private Double Lat;
private Double Lng;
}

triggers runtime DbException: "io.objectbox.exception.DbException: Indexing of float and double is currently unavailable. Please remove the index on Property Lat (5, Double)"

Logs & stackstraces

io.objectbox.exception.DbException: Indexing of float and double is currently unavailable. Please remove the index on Property Lat (5, Double)

Misc

Is there anything special about your app?
No

May transactions or multi-threading play a role?
No

Did you find any workarounds to prevent the issue?
No workarounds found to date

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中描述的 Java 复现开始:创建一个包含已建立索引的 Double 字段的 v1.5 数据库,然后移除注解并升级到 ObjectBox 2.3.4。跟踪会触发 DbException 的旧索引的迁移处理;当现有数据库能够在没有该过时索引的情况下成功打开并保留其数据时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
databases
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。