rajeshbabu created PHOENIX-1293:
-----------------------------------
Summary: By default we should not disable wal for immutable
indexes otherwise we end up in data loss on RS failure
Key: PHOENIX-1293
URL: https://issues.apache.org/jira/browse/PHOENIX-1293
Project: Phoenix
Issue Type: Bug
Affects Versions: 4.1
Reporter: rajeshbabu
Assignee: rajeshbabu
Priority: Critical
Fix For: 5.0.0, 4.2
Currently we are disabling wal for the indexes on table with immutable rows,
which user may not aware.
{code}
boolean disableWAL = false;
Boolean disableWALProp = (Boolean)
tableProps.remove(PhoenixDatabaseMetaData.DISABLE_WAL);
if (disableWALProp == null) {
disableWAL = isParentImmutableRows; // By default, disable WAL
for immutable indexes
} else {
disableWAL = disableWALProp;
}
{code}
Let's suppose region server holding the indexes regions restarted after writes
happened successfully, then index table entries in memstore will be lost and
finally end up with inconsistencies.
{code}
Here is the example:
0: jdbc:phoenix:10.18.40.169> create table t(a integer not null primary key,b
integer,c integer);
No rows affected (0.714 seconds)
0: jdbc:phoenix:10.18.40.169> alter table t set immutable_rows=true;
No rows affected (0.024 seconds)
0: jdbc:phoenix:10.18.40.169> create index t_idx on t(b);
No rows affected (0.685 seconds)
0: jdbc:phoenix:10.18.40.169> upsert into t values(1,2,3);
1 row affected (0.086 seconds)
0: jdbc:phoenix:10.18.40.169> upsert into t values(2,3,4);
1 row affected (0.012 seconds)
0: jdbc:phoenix:10.18.40.169> upsert into t values(3,4,5);
1 row affected (0.012 seconds)
0: jdbc:phoenix:10.18.40.169> select count(*) from t;
+------------+
| COUNT(1) |
+------------+
| 3 |
+------------+
1 row selected (0.083 seconds)
0: jdbc:phoenix:10.18.40.169> select count(*) from t_idx;
+------------+
| COUNT(1) |
+------------+
| 3 |
+------------+
1 row selected (8.367 seconds)
{code}
Restarted the region server here. Now the results are as below.here index
entries in the memstore are lost.
{code}
0: jdbc:phoenix:10.18.40.169> select count(*) from t;
+------------+
| COUNT(1) |
+------------+
| 3 |
+------------+
1 row selected (0.083 seconds)
0: jdbc:phoenix:10.18.40.169> select count(*) from t_idx;
+------------+
| COUNT(1) |
+------------+
| 0 |
+------------+
1 row selected (8.367 seconds)
{code}
So we need not disable wal by default until unless user specify explicitly.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)