hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rajeshbabu Chintaguntla (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-19593) Possible NPE if wal is closed during waledit append.
Date Fri, 22 Dec 2017 11:57:00 GMT

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

Rajeshbabu Chintaguntla updated HBASE-19593:
--------------------------------------------
    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

Pushed to master and branch-2. 

> 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)

Mime
View raw message