Apache Ignite persistent store recommended way for class versions

大城市里の小女人 提交于 2019-12-24 04:34:07

问题


In RDBMS systems I can add new columns even when there is already data in a table. I wonder what is the suggested way doing this with Ignite persistent store when storing class objects?

If I have the following class with lots of data:

public class Person implements Serializable
{
  @QuerySqlField
  String firstName;

  @QuerySqlField
  String lastName;
}

And later I may want to add a new fields to this class, like

public class Person implements Serializable
{
  @QuerySqlField
  String firstName;

  @QuerySqlField
  String lastName;

  @QuerySqlField
  Date birthday;
}

Can I put and get old and new versions of this class without problem? What happens to the new field value when I read an old version of the class from the persistent store?

How will SQL queries work when the column birthday is not available in old versions of the data?

Thanks for any suggestions.


回答1:


Yes, you can put and get objects transparently after updating the class definition on client side. The only requirement is to NOT deploy this class on local classpath of server nodes.

SQL, however, will not pick this up automatically and annotation will not be processed in this case. To change SQL schema in runtime you need to use DDL commands (ALTER TABLE, CREATE IMDEX, etc.). More details here: https://apacheignite-sql.readme.io/docs/ddl



来源:https://stackoverflow.com/questions/52044421/apache-ignite-persistent-store-recommended-way-for-class-versions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!