Skip to content

Commit

Permalink
[proxima-direct-transaction-manager] improve exceptions on invalid wr…
Browse files Browse the repository at this point in the history
…ites
  • Loading branch information
je-ik committed Oct 18, 2023
1 parent 8d8d415 commit 3683af3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,15 @@ public void commitWrite(List<StreamElement> outputs, CommitCallback callback)
transformed.size() == 1 && !isGlobalTransaction ? delegate : commitDelegate;
List<KeyAttribute> keyAttributes =
transformed.stream().map(KeyAttributes::ofStreamElement).collect(Collectors.toList());
boolean anyDisallowed = keyAttributes.stream().anyMatch(KeyAttribute::isWildcardQuery);
if (anyDisallowed) {
throw new IllegalArgumentException(
String.format(
"Invalid output writes %s. Wildcards need to have suffixes.",
keyAttributes.stream()
.filter(KeyAttribute::isWildcardQuery)
.collect(Collectors.toList())));
}
manager.commit(transactionId, keyAttributes);
Response response = takeResponse();
if (response.getFlags() != Response.Flags.COMMITTED) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@ static Iterable<KeyAttribute> concatInputsAndOutputs(
(a, b) -> a.getSequenceId() < b.getSequenceId() ? a : b));
outputAttributes.forEach(
ka -> {
Preconditions.checkArgument(!ka.isWildcardQuery());
Preconditions.checkArgument(
!ka.isWildcardQuery(), "Got KeyAttribute %s, which is not allowed output.", ka);
KeyWithAttribute kwa = KeyWithAttribute.of(ka);
if (!ka.getAttributeSuffix().isPresent()) {
mapOfInputs.putIfAbsent(kwa, ka);
Expand Down

0 comments on commit 3683af3

Please sign in to comment.