Skip to content

Commit

Permalink
Rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-da committed Aug 31, 2021
1 parent aec2a5c commit 1a981c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ private[backend] trait CommonStorageBackend[DB_BATCH] extends StorageBackend[DB_

// Events

// TODO Cleanup: Extract to [[EventStorageBackendTemplate]]
def pruneEvents(
pruneUpToInclusive: Offset,
pruneAllDivulgedContracts: Boolean,
Expand Down Expand Up @@ -526,11 +527,14 @@ private[backend] trait CommonStorageBackend[DB_BATCH] extends StorageBackend[DB_
}(connection, loggingContext)

if (pruneAllDivulgedContracts) {
val pruneAfterClause =
val pruneAfterClause = {
// We need to distinguish between the two cases since lexicographical comparison
// in Oracle doesn't work with '' (empty strings are treated as NULLs) as one of the operands
participantAllDivulgedContractsPrunedUpToInclusive(connection) match {
case Some(pruneAfter) => cSQL"and event_offset > $pruneAfter"
case None => cSQL""
}
}

pruneWithLogging(queryDescription = "Immediate divulgence events pruning") {
SQL"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private[backend] trait StorageBackendTestsPruning extends Matchers with StorageB
)
val contract1_retroactiveDivulgence =
dtoDivulgence(
offset = offset(3),
offset = Some(offset(3)),
eventSequentialId = 3L,
contractId = contract1_id,
divulgee = partyName,
Expand Down Expand Up @@ -236,7 +236,7 @@ private[backend] trait StorageBackendTestsPruning extends Matchers with StorageB
signatory = signatory,
)
val contract1_divulgence = dtoDivulgence(
offset = offset(2),
offset = Some(offset(2)),
eventSequentialId = 2L,
contractId = contract1_id,
divulgee = "party",
Expand All @@ -248,7 +248,7 @@ private[backend] trait StorageBackendTestsPruning extends Matchers with StorageB
contractId = contract1_id,
)
val contract2_divulgence = dtoDivulgence(
offset = offset(4),
offset = Some(offset(4)),
eventSequentialId = 4L,
contractId = contract2_id,
divulgee = divulgee,
Expand Down

0 comments on commit 1a981c2

Please sign in to comment.