ARTEMIS-2056 Set write position on JDBCFile copy
This commit is contained in:
parent
490ef71e1d
commit
b36a1058d4
|
@ -330,6 +330,7 @@ public class JDBCSequentialFile implements SequentialFile {
|
||||||
public SequentialFile cloneFile() {
|
public SequentialFile cloneFile() {
|
||||||
try {
|
try {
|
||||||
JDBCSequentialFile clone = new JDBCSequentialFile(fileFactory, filename, executor, dbDriver, writeLock);
|
JDBCSequentialFile clone = new JDBCSequentialFile(fileFactory, filename, executor, dbDriver, writeLock);
|
||||||
|
clone.setWritePosition(this.writePosition);
|
||||||
return clone;
|
return clone;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
fileFactory.onIOError(e, "Error cloning JDBC file.", this);
|
fileFactory.onIOError(e, "Error cloning JDBC file.", this);
|
||||||
|
@ -342,8 +343,13 @@ public class JDBCSequentialFile implements SequentialFile {
|
||||||
JDBCSequentialFile clone = (JDBCSequentialFile) cloneFile;
|
JDBCSequentialFile clone = (JDBCSequentialFile) cloneFile;
|
||||||
try {
|
try {
|
||||||
synchronized (writeLock) {
|
synchronized (writeLock) {
|
||||||
|
if (logger.isTraceEnabled()) {
|
||||||
|
logger.trace("JDBC Copying File. From: " + this + " To: " + cloneFile);
|
||||||
|
}
|
||||||
|
|
||||||
clone.open();
|
clone.open();
|
||||||
dbDriver.copyFileData(this, clone);
|
dbDriver.copyFileData(this, clone);
|
||||||
|
clone.setWritePosition(writePosition);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
fileFactory.onIOError(e, "Error copying JDBC file.", this);
|
fileFactory.onIOError(e, "Error copying JDBC file.", this);
|
||||||
|
|
|
@ -221,6 +221,9 @@ public class JDBCSequentialFileFactoryTest {
|
||||||
|
|
||||||
checkData(file, src);
|
checkData(file, src);
|
||||||
checkData(copy, src);
|
checkData(copy, src);
|
||||||
|
|
||||||
|
assertEquals(bufferSize, copy.size());
|
||||||
|
assertEquals(bufferSize, file.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue