add flush to gateway

This commit is contained in:
kimchy 2010-09-24 12:29:52 +02:00
parent 485f904140
commit 1c2733ebee
2 changed files with 17 additions and 0 deletions

View File

@ -87,6 +87,11 @@ public interface Translog extends IndexShardComponent {
*/
Snapshot snapshot(Snapshot snapshot);
/**
* Flushes the translog.
*/
void flush();
/**
* Closes the transaction log.
*/

View File

@ -185,6 +185,18 @@ public class FsTranslog extends AbstractIndexShardComponent implements Translog
}
}
@Override public void flush() {
synchronized (mutex) {
if (raf != null) {
try {
raf.raf().getFD().sync();
} catch (Exception e) {
// ignore
}
}
}
}
@Override public void close(boolean delete) {
synchronized (mutex) {
if (raf != null) {