Hello,

> Can I add fields without restarting the cluster?
Yes, It can be done via DDL command, as Ilya Kasnacheev mentioned.

Let's assume that you created a cache:
        CacheConfiguration cfg = new CacheConfiguration(PERSON_CACHE_NAME)
            .setIndexedTypes(Long.class, Person.class);

        IgniteCache cache = ignite.getOrCreateCache(cfg);

where the Person class has two fields 'id' and 'firstName'.

after that, you want to add a new field, for example, 'secondName'.
    // please take a look for the details:
https://apacheignite-sql.readme.io/docs/alter-table
    String ddl = "alter table Person add column secondName varchar";

    // execute the DDL command
    cache.query(new SqlFieldsQuery(ddl)).getAll();

    // new field should be queryable
    Iterator iter = cache.query(new SqlFieldsQuery("select secondName from
Person")).getAll());

hope it helps.

Thanks!



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to