NullPointerException in FsTranslog when reverting transient log
This happens when reverting the trans transaction log on failure, and when that happens, actually we might have failed on the transient translog creation to being with.... fixes #4223
This commit is contained in:
parent
fe1d22af01
commit
ed01d53506
|
@ -291,15 +291,19 @@ public class FsTranslog extends AbstractIndexShardComponent implements Translog
|
|||
|
||||
@Override
|
||||
public void revertTransient() {
|
||||
FsTranslogFile old;
|
||||
FsTranslogFile tmpTransient;
|
||||
rwl.writeLock().lock();
|
||||
try {
|
||||
old = trans;
|
||||
tmpTransient = trans;
|
||||
this.trans = null;
|
||||
} finally {
|
||||
rwl.writeLock().unlock();
|
||||
}
|
||||
old.close(true);
|
||||
// previous transient might be null because it was failed on its creation
|
||||
// for example
|
||||
if (tmpTransient != null) {
|
||||
tmpTransient.close(true);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] read(Location location) {
|
||||
|
|
Loading…
Reference in New Issue