Merged
Changes from 1 commit
Show all changes
25 commits
Select commit Hold shift + click to select a range
3872199
feat!: add support for CommitStats
olavloiteOct 24, 2020
def8768
fix: add clirr ignored differences
olavloiteOct 24, 2020
5372dae
Merge branch 'master' into commit-stats2
olavloiteOct 31, 2020
34fbda6
fix: error message should start with getCommitResponse
olavloiteOct 31, 2020
8f61c2a
Merge branch 'master' into commit-stats2
olavloiteNov 6, 2020
041b34d
Merge branch 'master' into commit-stats2
olavloiteDec 5, 2020
8299054
fix: remove overload delay
olavloiteDec 10, 2020
9b710a7
Merge branch 'master' into commit-stats2
olavloiteDec 10, 2020
8c15641
Merge branch 'master' into commit-stats2
olavloiteJan 23, 2021
919cf02
chore: cleanup after merge
olavloiteJan 23, 2021
97ec917
fix: update copyright years of new files
olavloiteJan 23, 2021
afeb0fd
test: fix flaky test
olavloiteJan 23, 2021
8524526
test: skip commit stats tests on emulator
olavloiteJan 23, 2021
06b3e22
test: missed one commit stats tests against emulator
olavloiteJan 23, 2021
1c17d16
test: skip another emulator test
olavloiteJan 23, 2021
664b87d
test: add missing test cases
olavloiteJan 23, 2021
6573a0f
fix: address review comments
olavloiteJan 30, 2021
0b448c3
Merge branch 'master' into commit-stats2
olavloiteFeb 1, 2021
83039fb
Merge branch 'master' into commit-stats2
olavloiteFeb 3, 2021
57ea714
chore: use junit assertion instead of truth
olavloiteFeb 3, 2021
66c5f88
chore: replace truth asserts with junit asserts
olavloiteFeb 4, 2021
1d17973
chore: replace truth assertions with junit
olavloiteFeb 5, 2021
48ef21b
chore: cleanup test and variable names
olavloiteFeb 8, 2021
1f33c42
fix: rename test method and variables
olavloiteFeb 9, 2021
7d45ace
fix: address review comments
olavloiteFeb 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
PrevPrevious commit
Next Next commit
fix: remove overload delay
  • Loading branch information
@olavloite
olavloite committedDec 10, 2020
commit 82990542eef1c43d58b50ace3e54c36406ef9d9a
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,28 +17,21 @@
package com.google.cloud.spanner;

import com.google.common.base.Preconditions;
import org.threeten.bp.Duration;
import org.threeten.bp.temporal.ChronoUnit;

/**
* Commit statistics are returned by a read/write transaction if specifically requested by passing
* in {@link Options#commitStats()} to the transaction.
*/
public class CommitStats {
private final long mutationCount;
private final Duration overloadDelay;

private CommitStats(long mutationCount, Duration overloadDelay) {
private CommitStats(long mutationCount) {
this.mutationCount = mutationCount;
this.overloadDelay = overloadDelay;
}

static CommitStats fromProto(com.google.spanner.v1.CommitResponse.CommitStats proto) {
Preconditions.checkNotNull(proto);
return new CommitStats(
proto.getMutationCount(),
Duration.of(proto.getOverloadDelay().getSeconds(), ChronoUnit.SECONDS)
.plusNanos(proto.getOverloadDelay().getNanos()));
return new CommitStats(proto.getMutationCount());
}

/**
Expand All@@ -58,9 +51,4 @@ static CommitStats fromProto(com.google.spanner.v1.CommitResponse.CommitStats pr
public long getMutationCount() {
return mutationCount;
}

/** The duration that the commit was delayed due to overloaded servers. */
public Duration getOverloadDelay() {
return overloadDelay;
}
}