}
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());
+ }
}
/**
*/
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
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
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 =()-> {
@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
if(lockId==null||lockId.isEmpty()||rangeId==null||rangeId.isEmpty()){
return;
}
+
unlockKeyInMusic(musicRangeInformationTableName, rangeId, lockId);
+
}
/**
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;
}
}
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);
}