Skip to content

Commit cb310a1

Browse files
chore(spanner): add missing commit ts logging (#13037)
1 parent 9aabeed commit cb310a1

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,28 @@ public void run() {
527527
return;
528528
}
529529
if (!proto.hasCommitTimestamp()) {
530+
if (proto.hasPrecommitToken() && retryAttemptDueToCommitProtocolExtension) {
531+
txnLogger.log(
532+
Level.FINE,
533+
"Missing commitTimestamp, response has precommit token "
534+
+ "and client has already attempted commit retry");
535+
span.addAnnotation(
536+
"Missing commitTimestamp, response has precommit token "
537+
+ "and client has already attempted commit retry");
538+
} else if (!proto.hasPrecommitToken()) {
539+
txnLogger.log(
540+
Level.FINE, "Missing commitTimestamp, response has no precommit token");
541+
span.addAnnotation(
542+
"Missing commitTimestamp, " + "response has no precommit token");
543+
}
530544
throw newSpannerException(
531-
ErrorCode.INTERNAL, "Missing commitTimestamp:\n" + session.getName());
545+
ErrorCode.INTERNAL,
546+
"Missing commitTimestamp:\n"
547+
+ session.getName()
548+
+ "\nHas precommit token: "
549+
+ proto.hasPrecommitToken()
550+
+ "\nAlready attempted commit retry: "
551+
+ retryAttemptDueToCommitProtocolExtension);
532552
}
533553
span.addAnnotation("Commit Done");
534554
opSpan.end();

0 commit comments

Comments
 (0)