Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap SaveSummary in transaction #54

Merged
merged 2 commits into from
Nov 7, 2024
Merged

Wrap SaveSummary in transaction #54

merged 2 commits into from
Nov 7, 2024

Conversation

trey-ivy
Copy link
Collaborator

@trey-ivy trey-ivy commented Nov 7, 2024

There are sometimes situations where the client will retry, and we have already serialzed part of the invocation to the database, but failed to serialize the whole thing, which causes issues. (Example logs below)

This PR implements a transaction wrapper in an attempt to address this. if we hit an error, we bail out of saving the invocation.

portal-9785fd988-gn9d7 backend 2024/11/04 13:43:00 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:00.023Z\",\n \"invocationAttemptFinished\": {\n \"invocationStatus\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:00 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:00.058Z\",\n \"buildFinished\": {\n \"status\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:26 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:26.519Z\",\n \"buildEnqueued\": {}\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:26 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:26.536Z\",\n \"invocationAttemptStarted\": {\n \"attemptNumber\": \"1\"\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:26 INFO Stream started event="context.Background.WithValue(transport.connectionKey, *net.TCPConn).WithValue(peer.peerKey, Peer{Addr: '10.132.0.92:39213', LocalAddr: '10.24.27.72:8082', AuthInfo: 'tls'}).WithCancel.WithValue(metadata.mdIncomingKey, metadata.MD).WithValue(grpc.serverKey, *grpc.Server).WithValue(grpc.streamKey, *transport.Stream).WithValue(grpc.rpcInfoContextKey, *grpc.rpcInfo).WithValue(b3.b3KeyType, bool).WithValue(b3.b3KeyType, bool).WithValue(trace.traceContextKeyType, trace.nonRecordingSpan).WithValue(trace.traceContextKeyType, *trace.recordingSpan).WithValue(trace.traceContextKeyType, *otel.activeSpan).WithValue(auth.authenticationMetadataKey, *auth.AuthenticationMetadata)" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:26 INFO Stream finished event="context.Background.WithValue(transport.connectionKey, *net.TCPConn).WithValue(peer.peerKey, Peer{Addr: '10.132.0.92:39213', LocalAddr: '10.24.27.72:8082', AuthInfo: 'tls'}).WithCancel.WithValue(metadata.mdIncomingKey, metadata.MD).WithValue(grpc.serverKey, *grpc.Server).WithValue(grpc.streamKey, *transport.Stream).WithValue(grpc.rpcInfoContextKey, *grpc.rpcInfo).WithValue(b3.b3KeyType, bool).WithValue(b3.b3KeyType, bool).WithValue(trace.traceContextKeyType, trace.nonRecordingSpan).WithValue(trace.traceContextKeyType, *trace.recordingSpan).WithValue(trace.traceContextKeyType, *otel.activeSpan).WithValue(auth.authenticationMetadataKey, *auth.AuthenticationMetadata)" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:26 INFO Saving invocation InvocationId=6657b2dc-a8fa-440f-8321-4b38393e71df BuildId=9a95e4a7-ee65-4fc7-a8a5-a518157afde0 Component=TOOL portal-9785fd988-gn9d7 backend 2024/11/04 13:43:26 INFO Saved invocation in 4.669009ms id=6657b2dc-a8fa-440f-8321-4b38393e71df portal-9785fd988-gn9d7 backend 2024/11/04 13:43:26 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:26.801Z\",\n \"invocationAttemptFinished\": {\n \"invocationStatus\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:26 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:26.838Z\",\n \"buildFinished\": {\n \"status\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:54 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:54.270Z\",\n \"buildEnqueued\": {}\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:54 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:54.282Z\",\n \"invocationAttemptStarted\": {\n \"attemptNumber\": \"1\"\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:54 INFO Stream started event="context.Background.WithValue(transport.connectionKey, *net.TCPConn).WithValue(peer.peerKey, Peer{Addr: '10.132.0.92:39213', LocalAddr: '10.24.27.72:8082', AuthInfo: 'tls'}).WithCancel.WithValue(metadata.mdIncomingKey, metadata.MD).WithValue(grpc.serverKey, *grpc.Server).WithValue(grpc.streamKey, *transport.Stream).WithValue(grpc.rpcInfoContextKey, *grpc.rpcInfo).WithValue(b3.b3KeyType, bool).WithValue(b3.b3KeyType, bool).WithValue(trace.traceContextKeyType, trace.nonRecordingSpan).WithValue(trace.traceContextKeyType, *trace.recordingSpan).WithValue(trace.traceContextKeyType, *otel.activeSpan).WithValue(auth.authenticationMetadataKey, *auth.AuthenticationMetadata)" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:54 INFO Stream finished event="context.Background.WithValue(transport.connectionKey, *net.TCPConn).WithValue(peer.peerKey, Peer{Addr: '10.132.0.92:39213', LocalAddr: '10.24.27.72:8082', AuthInfo: 'tls'}).WithCancel.WithValue(metadata.mdIncomingKey, metadata.MD).WithValue(grpc.serverKey, *grpc.Server).WithValue(grpc.streamKey, *transport.Stream).WithValue(grpc.rpcInfoContextKey, *grpc.rpcInfo).WithValue(b3.b3KeyType, bool).WithValue(b3.b3KeyType, bool).WithValue(trace.traceContextKeyType, trace.nonRecordingSpan).WithValue(trace.traceContextKeyType, *trace.recordingSpan).WithValue(trace.traceContextKeyType, *otel.activeSpan).WithValue(auth.authenticationMetadataKey, *auth.AuthenticationMetadata)" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:54 INFO Saving invocation InvocationId=777e5ebc-cf12-471f-b350-8a3269136919 BuildId=2977f0e8-08c0-40c4-9dce-d0e170f2ceda Component=TOOL portal-9785fd988-gn9d7 backend 2024/11/04 13:43:54 INFO Saved invocation in 8.13817ms id=777e5ebc-cf12-471f-b350-8a3269136919 portal-9785fd988-gn9d7 backend 2024/11/04 13:43:54 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:54.671Z\",\n \"invocationAttemptFinished\": {\n \"invocationStatus\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:54 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:54.705Z\",\n \"buildFinished\": {\n \"status\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:58 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:57.981Z\",\n \"buildEnqueued\": {}\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:58 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:57.990Z\",\n \"invocationAttemptStarted\": {\n \"attemptNumber\": \"1\"\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:58 INFO Stream started event="context.Background.WithValue(transport.connectionKey, *net.TCPConn).WithValue(peer.peerKey, Peer{Addr: '10.132.0.92:39213', LocalAddr: '10.24.27.72:8082', AuthInfo: 'tls'}).WithCancel.WithValue(metadata.mdIncomingKey, metadata.MD).WithValue(grpc.serverKey, *grpc.Server).WithValue(grpc.streamKey, *transport.Stream).WithValue(grpc.rpcInfoContextKey, *grpc.rpcInfo).WithValue(b3.b3KeyType, bool).WithValue(b3.b3KeyType, bool).WithValue(trace.traceContextKeyType, trace.nonRecordingSpan).WithValue(trace.traceContextKeyType, *trace.recordingSpan).WithValue(trace.traceContextKeyType, *otel.activeSpan).WithValue(auth.authenticationMetadataKey, *auth.AuthenticationMetadata)" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:58 INFO Stream finished event="context.Background.WithValue(transport.connectionKey, *net.TCPConn).WithValue(peer.peerKey, Peer{Addr: '10.132.0.92:39213', LocalAddr: '10.24.27.72:8082', AuthInfo: 'tls'}).WithCancel.WithValue(metadata.mdIncomingKey, metadata.MD).WithValue(grpc.serverKey, *grpc.Server).WithValue(grpc.streamKey, *transport.Stream).WithValue(grpc.rpcInfoContextKey, *grpc.rpcInfo).WithValue(b3.b3KeyType, bool).WithValue(b3.b3KeyType, bool).WithValue(trace.traceContextKeyType, trace.nonRecordingSpan).WithValue(trace.traceContextKeyType, *trace.recordingSpan).WithValue(trace.traceContextKeyType, *otel.activeSpan).WithValue(auth.authenticationMetadataKey, *auth.AuthenticationMetadata)" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:58 INFO Saving invocation InvocationId=a3587ea0-ffb1-4ee2-8cf3-7d84e566a6e9 BuildId=5fd59cbf-0a54-4505-85db-0a9d36681fe0 Component=TOOL portal-9785fd988-gn9d7 backend 2024/11/04 13:43:58 INFO Saved invocation in 4.89804ms id=a3587ea0-ffb1-4ee2-8cf3-7d84e566a6e9 portal-9785fd988-gn9d7 backend 2024/11/04 13:43:58 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:58.242Z\",\n \"invocationAttemptFinished\": {\n \"invocationStatus\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:43:58 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:43:58.275Z\",\n \"buildFinished\": {\n \"status\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:44:13 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:44:13.488Z\",\n \"buildEnqueued\": {}\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:44:13 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:44:13.499Z\",\n \"invocationAttemptStarted\": {\n \"attemptNumber\": \"1\"\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:44:13 INFO Stream started event="context.Background.WithValue(transport.connectionKey, *net.TCPConn).WithValue(peer.peerKey, Peer{Addr: '10.132.0.92:39213', LocalAddr: '10.24.27.72:8082', AuthInfo: 'tls'}).WithCancel.WithValue(metadata.mdIncomingKey, metadata.MD).WithValue(grpc.serverKey, *grpc.Server).WithValue(grpc.streamKey, *transport.Stream).WithValue(grpc.rpcInfoContextKey, *grpc.rpcInfo).WithValue(b3.b3KeyType, bool).WithValue(b3.b3KeyType, bool).WithValue(trace.traceContextKeyType, trace.nonRecordingSpan).WithValue(trace.traceContextKeyType, *trace.recordingSpan).WithValue(trace.traceContextKeyType, *otel.activeSpan).WithValue(auth.authenticationMetadataKey, *auth.AuthenticationMetadata)" portal-9785fd988-gn9d7 backend 2024/11/04 13:44:13 INFO Stream finished event="context.Background.WithValue(transport.connectionKey, *net.TCPConn).WithValue(peer.peerKey, Peer{Addr: '10.132.0.92:39213', LocalAddr: '10.24.27.72:8082', AuthInfo: 'tls'}).WithCancel.WithValue(metadata.mdIncomingKey, metadata.MD).WithValue(grpc.serverKey, *grpc.Server).WithValue(grpc.streamKey, *transport.Stream).WithValue(grpc.rpcInfoContextKey, *grpc.rpcInfo).WithValue(b3.b3KeyType, bool).WithValue(b3.b3KeyType, bool).WithValue(trace.traceContextKeyType, trace.nonRecordingSpan).WithValue(trace.traceContextKeyType, *trace.recordingSpan).WithValue(trace.traceContextKeyType, *otel.activeSpan).WithValue(auth.authenticationMetadataKey, *auth.AuthenticationMetadata)" portal-9785fd988-gn9d7 backend 2024/11/04 13:44:13 INFO Saving invocation InvocationId=d8787608-d2b0-4c8e-925f-302797ba0ecd BuildId=f46addc6-71e2-449f-af1d-9d9ef6b7b7fb Component=TOOL portal-9785fd988-gn9d7 backend 2024/11/04 13:44:13 INFO Saved invocation in 15.73136ms id=d8787608-d2b0-4c8e-925f-302797ba0ecd portal-9785fd988-gn9d7 backend 2024/11/04 13:44:13 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:44:13.771Z\",\n \"invocationAttemptFinished\": {\n \"invocationStatus\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:44:13 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:44:13.805Z\",\n \"buildFinished\": {\n \"status\": {\n \"result\": \"COMMAND_SUCCEEDED\"\n }\n }\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:44:52 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:44:52.615Z\",\n \"buildEnqueued\": {}\n}" portal-9785fd988-gn9d7 backend 2024/11/04 13:44:52 INFO Received event event="{\n \"eventTime\": \"2024-11-04T13:44:52.626Z\",\n \"invocationAttemptStarted\": {\n \"attemptNumber\": \"1\"\n }\n}" portal-9785fd9...

@mortenmj mortenmj merged commit b8abfd0 into main Nov 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants