Apache Ignite persistent store recommended way for

2019-07-18 06:40发布

问题:

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