ARTEMIS-716 max replication = 0 should mean do not make copies at all
This commit is contained in:
parent
bbb962045e
commit
87d3c1c9bd
|
@ -1136,6 +1136,11 @@ public interface ActiveMQServerLogger extends BasicLogger {
|
||||||
format = Message.Format.MESSAGE_FORMAT)
|
format = Message.Format.MESSAGE_FORMAT)
|
||||||
void activateSharedStoreSlaveFailed(@Cause Throwable e);
|
void activateSharedStoreSlaveFailed(@Cause Throwable e);
|
||||||
|
|
||||||
|
@LogMessage(level = Logger.Level.INFO)
|
||||||
|
@Message(id = 222190, value = "Deleting old data directory {0} as the max folders is set to 0", format = Message.Format.MESSAGE_FORMAT)
|
||||||
|
void backupDeletingData(String oldPath);
|
||||||
|
|
||||||
|
|
||||||
@LogMessage(level = Logger.Level.WARN)
|
@LogMessage(level = Logger.Level.WARN)
|
||||||
@Message(id = 222191,
|
@Message(id = 222191,
|
||||||
value = "Could not find any configured role for user {0}.",
|
value = "Could not find any configured role for user {0}.",
|
||||||
|
|
|
@ -98,16 +98,26 @@ public class FileMoveManager {
|
||||||
|
|
||||||
int whereToMove = getMaxID() + 1;
|
int whereToMove = getMaxID() + 1;
|
||||||
|
|
||||||
File folderTo = getFolder(whereToMove);
|
if (maxFolders == 0) {
|
||||||
folderTo.mkdirs();
|
ActiveMQServerLogger.LOGGER.backupDeletingData(folder.getPath());
|
||||||
|
for (String fileMove : files) {
|
||||||
|
File fileFrom = new File(folder, fileMove);
|
||||||
|
logger.tracef("deleting %s", fileFrom);
|
||||||
|
deleteTree(fileFrom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
File folderTo = getFolder(whereToMove);
|
||||||
|
folderTo.mkdirs();
|
||||||
|
|
||||||
ActiveMQServerLogger.LOGGER.backupMovingDataAway(folder.getPath(), folderTo.getPath());
|
ActiveMQServerLogger.LOGGER.backupMovingDataAway(folder.getPath(), folderTo.getPath());
|
||||||
|
|
||||||
for (String fileMove : files) {
|
for (String fileMove : files) {
|
||||||
File fileFrom = new File(folder, fileMove);
|
File fileFrom = new File(folder, fileMove);
|
||||||
File fileTo = new File(folderTo, fileMove);
|
File fileTo = new File(folderTo, fileMove);
|
||||||
logger.tracef("doMove:: moving %s as %s", fileFrom, fileTo);
|
logger.tracef("doMove:: moving %s as %s", fileFrom, fileTo);
|
||||||
Files.move(fileFrom.toPath(), fileTo.toPath());
|
Files.move(fileFrom.toPath(), fileTo.toPath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -117,9 +127,14 @@ public class FileMoveManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void internalCheckOldFolders(int creating) {
|
private void internalCheckOldFolders(int creating) {
|
||||||
if (maxFolders > 0) {
|
if (maxFolders >= 0) {
|
||||||
int folders = getNumberOfFolders();
|
int folders = getNumberOfFolders();
|
||||||
|
|
||||||
|
if (folders == 0) {
|
||||||
|
// no folders.. nothing to be done
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// We are counting the next one to be created
|
// We are counting the next one to be created
|
||||||
int foldersToDelete = folders + creating - maxFolders;
|
int foldersToDelete = folders + creating - maxFolders;
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class FileMoveManagerTest {
|
||||||
|
|
||||||
Assert.assertEquals(manager.getMaxFolders(), manager.getNumberOfFolders());
|
Assert.assertEquals(manager.getMaxFolders(), manager.getNumberOfFolders());
|
||||||
|
|
||||||
manager.setMaxFolders(0).checkOldFolders();
|
manager.setMaxFolders(-1).checkOldFolders();
|
||||||
|
|
||||||
Assert.assertEquals(3, manager.getNumberOfFolders());
|
Assert.assertEquals(3, manager.getNumberOfFolders());
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ public class FileMoveManagerTest {
|
||||||
|
|
||||||
Assert.assertEquals(manager.getMaxFolders(), manager.getNumberOfFolders());
|
Assert.assertEquals(manager.getMaxFolders(), manager.getNumberOfFolders());
|
||||||
|
|
||||||
manager.setMaxFolders(0).checkOldFolders();
|
manager.setMaxFolders(-1).checkOldFolders();
|
||||||
|
|
||||||
Assert.assertEquals(3, manager.getNumberOfFolders());
|
Assert.assertEquals(3, manager.getNumberOfFolders());
|
||||||
|
|
||||||
|
@ -267,6 +267,34 @@ public class FileMoveManagerTest {
|
||||||
Assert.assertEquals(10, manager.getMinID());
|
Assert.assertEquals(10, manager.getMinID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMaxZero() throws Exception {
|
||||||
|
manager.setMaxFolders(0);
|
||||||
|
|
||||||
|
int NUMBER_OF_FOLDERS = 10;
|
||||||
|
int FILES_PER_FOLDER = 10;
|
||||||
|
|
||||||
|
for (int bkp = 1; bkp <= 10; bkp++) {
|
||||||
|
for (int f = 0; f < NUMBER_OF_FOLDERS; f++) {
|
||||||
|
File folderF = new File(dataLocation, "folder" + f);
|
||||||
|
folderF.mkdirs();
|
||||||
|
|
||||||
|
// FILES_PER_FOLDER + f, I'm just creating more files as f grows.
|
||||||
|
// this is just to make each folder unique somehow
|
||||||
|
for (int i = 0; i < FILES_PER_FOLDER + f; i++) {
|
||||||
|
createFile(folderF, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
manager.doMove();
|
||||||
|
|
||||||
|
// We will always have maximum of 3 folders
|
||||||
|
Assert.assertEquals(0, manager.getNumberOfFolders());
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.assertEquals(0, manager.getMaxID());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMoveOverPaging() throws Exception {
|
public void testMoveOverPaging() throws Exception {
|
||||||
AssertionLoggerHandler.startCapture();
|
AssertionLoggerHandler.startCapture();
|
||||||
|
|
|
@ -66,7 +66,7 @@ Name | Description
|
||||||
[management-address](management.md "Configuring Core Management") | the name of the management address to send management messages to. It is prefixed with "jms.queue" so that JMS clients can send messages to it. Default=jms.queue.activemq.management
|
[management-address](management.md "Configuring Core Management") | the name of the management address to send management messages to. It is prefixed with "jms.queue" so that JMS clients can send messages to it. Default=jms.queue.activemq.management
|
||||||
[management-notification-address](management.md "Configuring The Core Management Notification Address") | the name of the address that consumers bind to receive management notifications. Default=activemq.notifications
|
[management-notification-address](management.md "Configuring The Core Management Notification Address") | the name of the address that consumers bind to receive management notifications. Default=activemq.notifications
|
||||||
[mask-password](configuration-index.md "Using Masked Passwords in Configuration Files") | This option controls whether passwords in server configuration need be masked. If set to "true" the passwords are masked. Default=false
|
[mask-password](configuration-index.md "Using Masked Passwords in Configuration Files") | This option controls whether passwords in server configuration need be masked. If set to "true" the passwords are masked. Default=false
|
||||||
[max-saved-replicated-journals-size]() | This specifies how many times a replicated backup server can restart after moving its files on start. Once there are this number of backup journal files the server will stop permanently after if fails back. Default=2
|
[max-saved-replicated-journals-size](ha.md#data-replication) | This specifies how many times a replicated backup server can restart after moving its files on start. Once there are this number of backup journal files the server will stop permanently after if fails back. -1 Means no Limit, 0 don't keep a copy at all, Default=2
|
||||||
[max-disk-usage](paging.md#max-disk-usage) | The max percentage of data we should use from disks. The System will block while the disk is full. Default=100
|
[max-disk-usage](paging.md#max-disk-usage) | The max percentage of data we should use from disks. The System will block while the disk is full. Default=100
|
||||||
[memory-measure-interval](perf-tuning.md) | frequency to sample JVM memory in ms (or -1 to disable memory sampling). Default=-1
|
[memory-measure-interval](perf-tuning.md) | frequency to sample JVM memory in ms (or -1 to disable memory sampling). Default=-1
|
||||||
[memory-warning-threshold](perf-tuning.md) | Percentage of available memory which will trigger a warning log. Default=25
|
[memory-warning-threshold](perf-tuning.md) | Percentage of available memory which will trigger a warning log. Default=25
|
||||||
|
|
|
@ -191,7 +191,7 @@ public abstract class FailoverTestBase extends ActiveMQTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupHAPolicyConfiguration() {
|
protected void setupHAPolicyConfiguration() {
|
||||||
((ReplicaPolicyConfiguration) backupConfig.getHAPolicyConfiguration()).setMaxSavedReplicatedJournalsSize(0).setAllowFailBack(true);
|
((ReplicaPolicyConfiguration) backupConfig.getHAPolicyConfiguration()).setMaxSavedReplicatedJournalsSize(-1).setAllowFailBack(true);
|
||||||
((ReplicaPolicyConfiguration) backupConfig.getHAPolicyConfiguration()).setRestartBackup(false);
|
((ReplicaPolicyConfiguration) backupConfig.getHAPolicyConfiguration()).setRestartBackup(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue