aboutsummaryrefslogtreecommitdiffstats
path: root/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicInterface.java
diff options
context:
space:
mode:
Diffstat (limited to 'mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicInterface.java')
-rwxr-xr-xmdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicInterface.java50
1 files changed, 37 insertions, 13 deletions
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 637cb15..b8ac563 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
@@ -45,19 +45,19 @@ import org.onap.music.mdbc.tables.*;
*/
public interface MusicInterface {
class OwnershipReturn{
- private final UUID ownershipId;
+ private final UUID ownershipOpId;
private final String lockId;
private final UUID rangeId;
private final Set<Range> ranges;
private final Dag dag;
- public OwnershipReturn(UUID ownershipId, String ownerId, UUID rangeId, Set<Range> ranges, Dag dag){
- this.ownershipId=ownershipId;
- this.lockId=ownerId;
+ public OwnershipReturn(UUID ownershipOpId, String lockId, UUID rangeId, Set<Range> ranges, Dag dag){
+ this.ownershipOpId=ownershipOpId;
+ this.lockId=lockId;
this.rangeId=rangeId;
this.ranges=ranges;
this.dag=dag;
}
- public String getOwnerId(){
+ public String getLockId(){
return lockId;
}
public UUID getRangeId(){
@@ -65,7 +65,7 @@ public interface MusicInterface {
}
public Set<Range> getRanges(){ return ranges; }
public Dag getDag(){return dag;}
- public UUID getOwnershipId() { return ownershipId; }
+ public UUID getOwnershipId() { return ownershipOpId; }
}
/**
* Get the name of this MusicInterface mixin object.
@@ -181,15 +181,21 @@ public interface MusicInterface {
/**
* Commits the corresponding REDO-log into MUSIC
+ * Transaction is committed -- add all the updates into the REDO-Log in MUSIC
+ *
+ * This officially commits the transaction globally
+ *
+ *
*
* @param partition information related to ownership of partitions, used to verify ownership when commiting the Tx
* @param eventualRanges
* @param transactionDigest digest of the transaction that is being committed into the Redo log in music.
* @param txId id associated with the log being send
* @param progressKeeper data structure that is used to handle to detect failures, and know what to do
+ * @return digest that was created for this transaction commit
* @throws MDBCServiceException
*/
- void commitLog(DatabasePartition partition, Set<Range> eventualRanges, StagingTable transactionDigest, String txId,TxCommitProgress progressKeeper) throws MDBCServiceException;
+ public MusicTxDigestId commitLog(DatabasePartition partition, Set<Range> eventualRanges, StagingTable transactionDigest, String txId,TxCommitProgress progressKeeper) throws MDBCServiceException;
/**
@@ -213,10 +219,11 @@ public interface MusicInterface {
/**
* This function is used to create a new locked row in the MRI table
* @param info the information used to create the row
+ * @param owner owner of the lock for deadlock detection
* @return the new partition object that contain the new information used to create the row
* @throws MDBCServiceException
*/
- DatabasePartition createLockedMRIRow(MusicRangeInformationRow info) throws MDBCServiceException;
+ DatabasePartition createLockedMRIRow(MusicRangeInformationRow info, String owner) throws MDBCServiceException;
/**
* This function is used to create all the required music dependencies
@@ -320,10 +327,13 @@ public interface MusicInterface {
void updateNodeInfoTableWithTxTimeIDKey(UUID txTimeID, String nodeName) throws MDBCServiceException;
String createLock(LockRequest request) throws MDBCServiceException;
+ String createLock(LockRequest request, String ownerId) throws MDBCServiceException;
LockResult acquireLock(LockRequest request, String lockId) throws MDBCServiceException;
void releaseLocks(Map<UUID, LockResult> newLocks) throws MDBCServiceException;
+ public void releaseAllLocksForOwner(String owner, String keyspace, String table) throws MDBCServiceException;
+
/**
* Combine previous musicrangeinformation rows for new partition, if necessary
*
@@ -331,13 +341,26 @@ public interface MusicInterface {
*
* @param currentlyOwned
* @param locksForOwnership
- * @param ownershipId
+ * @param ownershipOpId
+ * @param ownerId
* @return
* @throws MDBCServiceException
*/
- OwnershipReturn mergeLatestRowsIfNecessary(Dag currentlyOwned, Map<UUID, LockResult> locksForOwnership, UUID ownershipId)
- throws MDBCServiceException;
-
+ OwnershipReturn mergeLatestRowsIfNecessary(Dag currentlyOwned, Map<UUID, LockResult> locksForOwnership,
+ UUID ownershipOpId, String ownerId) throws MDBCServiceException;
+
+ /**
+ * If this connection is using fewer ranges than what is owned in the current partition, split
+ * the partition to avoid a universal partition being passed around.
+ *
+ * This will follow "most recently used" policy
+ * @param partition2 partition that this transaction currently owns
+ * @param rangesUsed set of ranges that is the minimal required for this transaction
+ * @throws MDBCServiceException
+ */
+ public DatabasePartition splitPartitionIfNecessary(DatabasePartition partition, Set<Range> rangesUsed,
+ String ownerId) throws MDBCServiceException;
+
/**
* Create ranges in MRI table, if not already present
* @param range to add into mri table
@@ -349,8 +372,9 @@ public interface MusicInterface {
* This is an eventual operation for minimal performance hits
* @param r
* @param playbackPointer
+ * @throws MDBCServiceException
*/
- public void updateCheckpointLocations(Range r, Pair<UUID, Integer> playbackPointer);
+ public void updateCheckpointLocations(Range r, Pair<MriReference, MusicTxDigestId> playbackPointer);
}