mirror of https://github.com/apache/activemq.git
[AMQ-4947] ensure index page file does not skip forcing metadata - size is important to the page file
This commit is contained in:
parent
2e492569db
commit
42bf6e9061
|
@ -378,7 +378,7 @@ public class PageFile {
|
||||||
|
|
||||||
File file = getMainPageFile();
|
File file = getMainPageFile();
|
||||||
IOHelper.mkdirs(file.getParentFile());
|
IOHelper.mkdirs(file.getParentFile());
|
||||||
writeFile = new RecoverableRandomAccessFile(file, "rw");
|
writeFile = new RecoverableRandomAccessFile(file, "rw", false);
|
||||||
readFile = new RecoverableRandomAccessFile(file, "r");
|
readFile = new RecoverableRandomAccessFile(file, "r");
|
||||||
|
|
||||||
if (readFile.length() > 0) {
|
if (readFile.length() > 0) {
|
||||||
|
|
|
@ -31,17 +31,21 @@ public class RecoverableRandomAccessFile implements java.io.DataOutput, java.io.
|
||||||
RandomAccessFile raf;
|
RandomAccessFile raf;
|
||||||
File file;
|
File file;
|
||||||
String mode;
|
String mode;
|
||||||
|
final boolean isSkipMetadataUpdate;
|
||||||
|
|
||||||
public RecoverableRandomAccessFile(File file, String mode) throws FileNotFoundException {
|
public RecoverableRandomAccessFile(File file, String mode, boolean skipMetadataUpdate) throws FileNotFoundException {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
raf = new RandomAccessFile(file, mode);
|
raf = new RandomAccessFile(file, mode);
|
||||||
|
isSkipMetadataUpdate = skipMetadataUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RecoverableRandomAccessFile(File file, String mode) throws FileNotFoundException {
|
||||||
|
this(file, mode, SKIP_METADATA_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecoverableRandomAccessFile(String name, String mode) throws FileNotFoundException {
|
public RecoverableRandomAccessFile(String name, String mode) throws FileNotFoundException {
|
||||||
this.file = new File(name);
|
this(new File(name), mode);
|
||||||
this.mode = mode;
|
|
||||||
raf = new RandomAccessFile(file, mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RandomAccessFile getRaf() throws IOException {
|
public RandomAccessFile getRaf() throws IOException {
|
||||||
|
@ -394,7 +398,7 @@ public class RecoverableRandomAccessFile implements java.io.DataOutput, java.io.
|
||||||
|
|
||||||
public void sync() throws IOException {
|
public void sync() throws IOException {
|
||||||
try {
|
try {
|
||||||
getRaf().getChannel().force(!SKIP_METADATA_UPDATE);;
|
getRaf().getChannel().force(!isSkipMetadataUpdate);;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
handleException();
|
handleException();
|
||||||
throw ioe;
|
throw ioe;
|
||||||
|
|
Loading…
Reference in New Issue