Skip to content

Commit

Permalink
ISPN-11845 SingleFileStore location validation should be skipped when…
Browse files Browse the repository at this point in the history
… global state is disabled
  • Loading branch information
pferraro committed May 15, 2020
1 parent 04778dc commit b4bf801
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public void validate() {

@Override
public void validate(GlobalConfiguration globalConfig) {
Attribute<String> location = attributes.attribute(LOCATION);
if (location.isNull() && !globalConfig.globalState().enabled()) {
Log.CONFIG.storeLocationRequired();
}
super.validate(globalConfig);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -118,7 +119,7 @@ public class SingleFileStore<K, V> implements AdvancedLoadWriteStore<K, V> {
private MarshallableEntryFactory<K, V> entryFactory;

public static File getStoreFile(GlobalConfiguration globalConfiguration, String locationPath, String cacheName) {
Path location = PersistenceUtil.getLocation(globalConfiguration, locationPath);
Path location = globalConfiguration.globalState().enabled() ? PersistenceUtil.getLocation(globalConfiguration, locationPath) : Paths.get(locationPath);
return new File(location.toFile(), cacheName + ".dat");
}

Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/org/infinispan/util/logging/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -2002,4 +2002,7 @@ TimeoutException coordinatorTimeoutWaitingForView(int expectedViewId, int curren

@Message(value = "A store cannot be configured with both preload and purgeOnStartup", id = 589)
CacheConfigurationException preloadAndPurgeOnStartupConflict();

@Message(value = "Store must specify a location when global state is disabled", id = 590)
CacheConfigurationException storeLocationRequired();
}

0 comments on commit b4bf801

Please sign in to comment.