aboutsummaryrefslogtreecommitdiffstats
path: root/mdbc-server
diff options
context:
space:
mode:
Diffstat (limited to 'mdbc-server')
-rwxr-xr-xmdbc-server/src/main/java/org/onap/music/mdbc/Configuration.java4
-rwxr-xr-xmdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java5
-rw-r--r--mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java3
-rwxr-xr-xmdbc-server/src/main/resources/mdbc.properties2
4 files changed, 14 insertions, 0 deletions
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/Configuration.java b/mdbc-server/src/main/java/org/onap/music/mdbc/Configuration.java
index 91b13f3..efe4c21 100755
--- a/mdbc-server/src/main/java/org/onap/music/mdbc/Configuration.java
+++ b/mdbc-server/src/main/java/org/onap/music/mdbc/Configuration.java
@@ -48,4 +48,8 @@ public class Configuration {
public static final String KEY_WARMUPRANGES = "warmupranges";
/** Default async staging table update o ption*/
public static final String ASYNC_STAGING_TABLE_UPDATE = "false";
+ /** The property name to determine if only write locks are allowed */
+ public static final String KEY_WRITE_LOCKS_ONLY = "write_locks_only";
+ /** Default if only write locks are allowed */
+ public static final Boolean WRITE_LOCK_ONLY_DEFAULT = false;
}
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java
index b60062e..ee742f8 100755
--- a/mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java
+++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java
@@ -49,6 +49,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.json.JSONObject;
public class MDBCUtils {
+ public static boolean writeLocksOnly = false;
public static void saveToFile(String serializedContent, String filename, EELFLoggerDelegate logger) throws IOException {
try (PrintWriter fout = new PrintWriter(filename)) {
@@ -129,6 +130,10 @@ public class MDBCUtils {
* @return write if any table has a write query. Read otherwise
*/
public static SQLOperationType getOperationType(Map<String, List<SQLOperation>> tableToQueryType) {
+ if (writeLocksOnly) {
+ return SQLOperationType.WRITE;
+ }
+
for (List<org.onap.music.mdbc.query.SQLOperation> tablesOps : tableToQueryType.values()) {
for (org.onap.music.mdbc.query.SQLOperation op : tablesOps) {
if (op.getOperationType() != SQLOperationType.READ) {
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java b/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java
index 8d42370..f8a18d9 100644
--- a/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java
+++ b/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java
@@ -122,6 +122,9 @@ public class StateManager {
cassandraUrl = info.getProperty(Configuration.KEY_CASSANDRA_URL, Configuration.CASSANDRA_URL_DEFAULT);
musicmixin = info.getProperty(Configuration.KEY_MUSIC_MIXIN_NAME, Configuration.MUSIC_MIXIN_DEFAULT);
+ String writeLocksOnly = info.getProperty(Configuration.KEY_WRITE_LOCKS_ONLY);
+ MDBCUtils.writeLocksOnly = (writeLocksOnly==null) ? Configuration.WRITE_LOCK_ONLY_DEFAULT : Boolean.parseBoolean(writeLocksOnly);
+
initMusic();
initSqlDatabase();
initTxDaemonThread();
diff --git a/mdbc-server/src/main/resources/mdbc.properties b/mdbc-server/src/main/resources/mdbc.properties
index 4d69da6..60adfae 100755
--- a/mdbc-server/src/main/resources/mdbc.properties
+++ b/mdbc-server/src/main/resources/mdbc.properties
@@ -18,5 +18,7 @@ DEFAULT_DRIVERS=\
# whether or not to split the partitions
partition_splitting=true
+write_locks_only=true
+
#time, in seconds, between when the daemon catches up
txdaemonsleeps=15 \ No newline at end of file