Pivotal Knowledge Base

Follow

Failed to create child table because of parents evictation policy

Applies to

GemFire XD and SQLFire

Issue

When creating a table with a foriegn key the following error is received:

Failed to create table 'B' due to referenced table 'A' having eviction or expiration policy.

Example of SQL for creating tables:

create table A (
ID bigint generated always as identity,
label varchar(64) not null,
primary key (ID)
)
PERSISTENT ASYNCHRONOUS
EVICTION BY LRUHEAPPERCENT
PARTITION BY COLUMN(ID)
REDUNDANCY 1;
create table B (
ID bigint generated always as identity,
A_ID bigint not null,
label varchar(64) not null,
foreign key (A_ID) references A
);

The parent table in this scenario doesn't allow a child with a foreign key as the default eviction action is DESTROY as the delete isn´t cascading.

Solution

A way to work around this is to configure the evictation action to something other than the default DESTROY as in the following example where OVERFLOW to disk is usedÑ

create table A (
ID bigint generated always as identity,
label varchar(64) not null,
primary key (ID)
)
PERSISTENT ASYNCHRONOUS
EVICTION BY LRUHEAPPERCENT EVICTATION OVERFLOW
PARTITION BY COLUMN(ID)
REDUNDANCY 1;

Comments

Powered by Zendesk