diff options
5 files changed, 16 insertions, 2 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 b3ec61d..5b2b8df 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 @@ -123,6 +123,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 @@ -229,8 +229,8 @@ </dependency> <dependency> <groupId>org.onap.music</groupId> - <artifactId>dev-MUSIC-cassandra</artifactId> - <version>3.2.1</version> + <artifactId>MUSIC</artifactId> + <version>3.2.34-SNAPSHOT</version> <exclusions> <exclusion> <groupId>io.netty</groupId> |