diff options
5 files changed, 27 insertions, 10 deletions
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java index 3cbd1e0..61ce6bd 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java @@ -240,6 +240,15 @@ public class MdbcConnection implements Connection { } jdbcConn.rollback(); progressKeeper.reinitializeTxProgress(id); + + //\TODO try to execute outside of the critical path of commit + try { + if(partition != null) { + mi.relinquish(partition); + } + } catch (MDBCServiceException e) { + logger.warn("Error trying to relinquish: "+partition.toString()); + } } /** diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicInterface.java b/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicInterface.java index 62259a8..3d0cc0a 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicInterface.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicInterface.java @@ -281,8 +281,11 @@ public interface MusicInterface { */ public void relinquish(DatabasePartition partition) throws MDBCServiceException; + @Deprecated /** - * This functions relinquishes a range + * This functions relinquishes a range; + * Deprecated because it does not have the mechanism to set the partition lock to null + * see relinquish(DatabasePartition partition) * @param lockId id of the lock to be relinquished * @param rangeId id of the range to be relinquished * @throws MusicLockingException diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicMixin.java b/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicMixin.java index 6939d78..f22daa3 100644 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicMixin.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicMixin.java @@ -1307,6 +1307,11 @@ public class MusicMixin implements MusicInterface { return; } + //Add creation type of transaction digest + if(transactionDigest == null || transactionDigest.isEmpty()) { + return; + } + UUID mriIndex = partition.getMRIIndex(); String fullyQualifiedMriKey = music_ns+"."+ this.musicRangeInformationTableName+"."+mriIndex; //0. See if reference to lock was already created @@ -1315,10 +1320,6 @@ public class MusicMixin implements MusicInterface { throw new MDBCServiceException("Not able to commit, as you are no longer the lock-holder for this partition"); } - //Add creation type of transaction digest - if(transactionDigest == null || transactionDigest.isEmpty()) { - return; - } final MusicTxDigestId digestId = new MusicTxDigestId(MDBCUtils.generateUniqueKey(), -1); Callable<Boolean> insertDigestCallable =()-> { @@ -2193,12 +2194,13 @@ public class MusicMixin implements MusicInterface { @Override public void relinquish(DatabasePartition partition) throws MDBCServiceException { - String ownerId = partition.getLockId(); + String lockId = partition.getLockId(); String rangeId = partition.getMRIIndex().toString(); - if(ownerId==null||ownerId.isEmpty()||rangeId==null||rangeId.isEmpty()){ + if(lockId==null||lockId.isEmpty()||rangeId==null||rangeId.isEmpty()){ return; } - unlockKeyInMusic(musicRangeInformationTableName, rangeId, ownerId); + unlockKeyInMusic(musicRangeInformationTableName, rangeId, lockId); + partition.setLockId(null); } @Override @@ -2206,7 +2208,9 @@ public class MusicMixin implements MusicInterface { if(lockId==null||lockId.isEmpty()||rangeId==null||rangeId.isEmpty()){ return; } + unlockKeyInMusic(musicRangeInformationTableName, rangeId, lockId); + } /** diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/ownership/OwnershipAndCheckpoint.java b/mdbc-server/src/main/java/org/onap/music/mdbc/ownership/OwnershipAndCheckpoint.java index 218993b..854eb5f 100644 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/ownership/OwnershipAndCheckpoint.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/ownership/OwnershipAndCheckpoint.java @@ -367,12 +367,13 @@ public class OwnershipAndCheckpoint{ logger.warn("Locking failed, retrying",e); } } + // TODO look into updating the partition object with the latest lockId; if(owned){ toOwn.setOwn(node); newLocks.put(uuidToOwn,result); } else{ - mi.relinquish(lockId, partition.getMRIIndex().toString()); + mi.relinquish(lockId,uuidToOwn.toString()); break; } } diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/query/QueryProcessor.java b/mdbc-server/src/main/java/org/onap/music/mdbc/query/QueryProcessor.java index 06ad252..a31a2a0 100644 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/query/QueryProcessor.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/query/QueryProcessor.java @@ -96,7 +96,7 @@ public class QueryProcessor { try { sqlNode = getSqlParser(query).parseStmt(); } catch (SqlParseException e) { - logger.error(EELFLoggerDelegate.errorLogger, "Unable to parse query: " + query +". " + e.getMessage()); + logger.warn(EELFLoggerDelegate.errorLogger, "Unable to parse query: " + query + "; Falling back to Secondary basic parser",e); return basicStringParser(query, tables); } |