Rajeshbabu Chintaguntla created HBASE-19593:
-----------------------------------------------
Summary: Possible NPE if wal is closed during waledit append.
Key: HBASE-19593
URL: https://issues.apache.org/jira/browse/HBASE-19593
Project: HBase
Issue Type: Bug
Reporter: Rajeshbabu Chintaguntla
Assignee: Rajeshbabu Chintaguntla
Fix For: 3.0.0, 2.0.0-beta-1
There is a possible NPE when a wal is closed during waledit append because of
not setting write entry to the wal key. Here is the code we are not setting
write entry to wal key when when wal is closed.
{noformat}
if (this.closed) {
throw new IOException(
"Cannot append; log is closed, regionName = " +
hri.getRegionNameAsString());
}
MutableLong txidHolder = new MutableLong();
MultiVersionConcurrencyControl.WriteEntry we = key.getMvcc().begin(() -> {
txidHolder.setValue(ringBuffer.next());
});
long txid = txidHolder.longValue();
try (TraceScope scope = TraceUtil.createTrace(implClassName + ".append")) {
FSWALEntry entry = new FSWALEntry(txid, key, edits, hri, inMemstore);
entry.stampRegionSequenceId(we);
ringBuffer.get(txid).load(entry);
} finally {
ringBuffer.publish(txid);
}
return txid;
{noformat}
But on failure complete on mvcc will be called with nulll write entry cause
NPE.
{noformat}
WriteEntry writeEntry = null;
try {
long txid = this.wal.append(this.getRegionInfo(), walKey, walEdit, true);
// Call sync on our edit.
if (txid != 0) {
sync(txid, durability);
}
writeEntry = walKey.getWriteEntry();
} catch (IOException ioe) {
if (walKey != null) {
mvcc.complete(walKey.getWriteEntry());
}
throw ioe;
}
{noformat}
We are able to reproduce with mocking in one of the phoenix test cases to test
wal replay.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)