[TEST] Port testcase from #19035 to master

This commit is contained in:
Simon Willnauer 2016-06-23 22:49:19 +02:00
parent c49ec957eb
commit 148e64d654
1 changed files with 19 additions and 0 deletions

View File

@ -1902,4 +1902,23 @@ public class TranslogTests extends ESTestCase {
Checkpoint read = Checkpoint.read(tempDir.resolve("foo.cpk")); Checkpoint read = Checkpoint.read(tempDir.resolve("foo.cpk"));
assertEquals(read, checkpoint); assertEquals(read, checkpoint);
} }
/**
* Tests that closing views after the translog is fine and we can reopen the translog
*/
public void testPendingDelete() throws IOException {
translog.add(new Translog.Index("test", "1", new byte[]{1}));
translog.prepareCommit();
Translog.TranslogGeneration generation = translog.getGeneration();
TranslogConfig config = translog.getConfig();
translog.close();
translog = new Translog(config, generation);
translog.add(new Translog.Index("test", "2", new byte[]{2}));
translog.prepareCommit();
Translog.View view = translog.newView();
translog.add(new Translog.Index("test", "3", new byte[]{3}));
translog.close();
IOUtils.close(view);
translog = new Translog(config, generation);
}
} }