Hi all, I'm migrating to Ignite 3.1 (coming from 2.x) but I'm having some
questions in regard to the Java API.
1) KeyValue behaviour
@Table(value = InfoEntry.TABLE_NAME,
zone = @Zone(value = IgniteDB.ZONE_PERSIST_DEFAULT, storageProfiles
= IgniteDB.STORAGE_PROFILE_DEFAULT)
)
public class InfoEntry implements Serializable {
public static final String TABLE_NAME = "user_info";
@Id
@Column("local_id")
public Long localId;
@Column("email")
public String email;
.... more fields
}
ignite.catalog().createTable(InfoEntry.class);
table = ignite.tables().table(InfoEntry.TABLE_NAME);
KeyValueView<Long, InfoEntry> kvView= table.keyValueView(
Mapper.of(Long.class, "local_id"),
Mapper.of(InfoEntry.class)
);
Now clearly any operation on the KeyValueView will fail reasonably since
you cannot 'duplicate' the key column on a value column;
org.apache.ignite.lang.MarshallerException: IGN-MARSHALLING-1 Fields
[localId] of type User.InfoEntry are not mapped to columns TraceId:
However, is there any way I can map it intuitively like that? I'd like to
have both primary ID/keys together in my value class.
I know I could just duplicate another column holding the key value, or use
RecordView which is the correct way to do so but for get operations you
have to;
1. Create a new object where only the key(s) are populated
InfoEntry key = new InfoEntry();
key.localId = 10L;
2. Pass it to the getter
3. receive another new object of the same type
InfoEntry result = recordView.get(null, key);
I'm probably thinking too much about the overhead but it seems costly,
especially if you are using large classes.
2) @Table annotation and inheritance
I create zones like this;
String ZONE_PERSIST_DEFAULT = "default_zone_persistent";
String STORAGE_PROFILE_DEFAULT = "default_aipersist";
ZoneDefinition zoneDefinition = ZoneDefinition.builder(ZONE_PERSIST_DEFAULT)
.partitions(64)
.replicas(3)
.storageProfiles(STORAGE_PROFILE_DEFAULT)
.dataNodesAutoAdjustScaleUp(120)
.dataNodesAutoAdjustScaleDown(360)
.ifNotExists()
.build();
ignite.catalog().createZone(zoneDefinition);
But the @Zone annotation always requires 'storageProfile', can this not be
inherited?
@Table(value = InfoEntry.TABLE_NAME,
zone = @Zone(value = ZONE_PERSIST_DEFAULT, storageProfiles =
STORAGE_PROFILE_DEFAULT)
)
3) Table creation;
Table table = ignite.tables().table(InfoEntry.TABLE_NAME);
if (table == null) {
ignite.catalog().createTable(InfoEntry.class);
table = ignite.tables().table(InfoEntry.TABLE_NAME);
}
Can't createTable(...) not return the Table upon success? I've also noticed
using DBeaver that tables created this way have their names in uppercase.
4) Is there an eta on 3.2?
I saw a lot of closed tickets on the 3.2 tracker with many QOL
improvements, will there be any breaking changes and should I wait for my
migration from 2.x?
Thanks in advance and for all your hard work within the Ignite projects,
Gilles