You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Rajeshbabu Chintaguntla (JIRA)" <ji...@apache.org> on 2017/12/22 09:30:00 UTC

[jira] [Updated] (HBASE-19593) Possible NPE if wal is closed during waledit append.

     [ https://issues.apache.org/jira/browse/HBASE-19593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajeshbabu Chintaguntla updated HBASE-19593:
--------------------------------------------
    Attachment: HBASE-19593.patch

Here is the patch.
[~stack] [~anoop.hbase] [~ram_krish] Please review.

> 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
>
>         Attachments: HBASE-19593.patch
>
>
> 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)