-
Notifications
You must be signed in to change notification settings - Fork 68
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
fix: add stored status explicitly for logs #704
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/kind flake |
The following is the coverage report on the affected files.
|
8566133
to
b8c3958
Compare
b8c3958
to
a57be30
Compare
As discussed in the WG meeting, I have tested it for partial log store, and it seems there is only one issue (not ATM) we need to take care of.
In case of S3 or GCS the partial logs will be discarded. |
Please also keep in mind this is an API change, previously stored data will not have the field |
It seems we need to add WIP tag to this PR if it's still being worked on. Thanks. |
a57be30
to
70fe882
Compare
70fe882
to
b253638
Compare
c455695
to
1e26f25
Compare
The following is the coverage report on the affected files.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we adding stored status for logs?
Can you have two commits here? One for API and other for status. It's easier to review then. |
1e26f25
to
84acda7
Compare
The following is the coverage report on the affected files.
|
@khrm @gabemontero I have broken the commits in two and also updated the PR description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
cmd/api/main.go
Outdated
@@ -180,19 +180,19 @@ func main() { | |||
recovery.StreamServerInterceptor(recovery.WithRecoveryHandler(recoveryHandler)), | |||
), | |||
) | |||
v1alpha2pb.RegisterResultsServer(gs, v1a2) | |||
v1alpha3pb.RegisterResultsServer(gs, v1a2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to register a result server for v1alpha2 in addition to v1alpha3 so the api server can serve clients accessing either version @avinal @sayan-biswas ?
per the wg call @avinal you need to test this at least manually .... if an e2e could be created that does curls against both versions, even better ..... one could argue that an e2e for accessing both versions should be a requirement for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the tests, but I think something is getting wrong. If I update the server with the new code on the same DB, the logs are not being stored. I will try to find out the reason and fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We change the API version for breaking change only. Otherwise, you need to add proto for both v1alpha2 and v1alpha3. Adding a field or method isn't a breaking change. Renaming or removing them is a breaking change.
In this PR, I don't find any new field or method in proto. Only an internal behaviour change which I don't think requires a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we roll back to just migrating the DB?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to migrate the DB? Isn't it part of json field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we update the Log Object version? Why is it necessary for it to have the same version as API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not, we discussed in the call that to keep things in sync we can update the whole API. Do you think we should rediscuss the context and implementation for this in the next call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should rediscuss this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding object specific versioning is atypical at least from a k8s perspective
is there precedent in tekton @khrm that I'm missing?
that said @avinal if you and @sayan-biswas have not had a chance to get together and sort out the issues in your testing that we discussed, at this point I'm up for any path with is both a) not too crazy, and b) does not require a migrator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are updating the Object version here as well as the API. That object is internal to Results. That was the context of my comment. Let's discuss this in WG call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change require proto change? We are changing version of Log version in DB.
Just changing https://github.com/tektoncd/results/blob/84acda76c4cc0193eaa63d443148e912d2c192ba/pkg/apis/v1alpha3/types.go should work.
Should TaskRunLog stored in DB mirror GRPC version?
84acda7
to
229d5f4
Compare
229d5f4
to
505ae4e
Compare
The following is the coverage report on the affected files.
|
@@ -112,13 +112,13 @@ func TestParseName(t *testing.T) { | |||
} | |||
|
|||
func TestToStorage(t *testing.T) { | |||
log := &v1alpha2.Log{ | |||
log := &v1alpha3.Log{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we not have at least one v1alpha2 test case to validate that behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests won't work because we no longer have v1alpha2, to simulate, we have to retain the v1alpha2 types as well.
Value: jsonutil.AnyBytes(t, &v1alpha2.Log{ | ||
Spec: v1alpha2.LogSpec{ | ||
Resource: v1alpha2.Resource{ | ||
Type: v1alpha3.LogRecordType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we have at least one v1alpha2 test case to validate that behavior?
@@ -320,7 +320,7 @@ func toJSON(v any) []byte { | |||
} | |||
|
|||
func TestToLogProto(t *testing.T) { | |||
wantType := "results.tekton.dev/v1alpha2.Log" | |||
wantType := "results.tekton.dev/v1alpha3.Log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will convert.go ever encounter v1alpha2?
bump on my last round of comments @avinal : https://github.com/tektoncd/results/pull/704/files/505ae4eb5ed61f87d578495f972a1729f72fba62 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some additional thoughts occurred to me @avinal @sayan-biswas @khrm @enarha @ramessesii2 while I was considering this change for helping with fixing the memory leak and canceled context issues with sufficient latency / performance characteristics
let's add this to my prior ask for additional unit tests
also @avinal are you going to be able to spend time on wrapping this PR up this week? if not, let me know and I'll see about getting this over the finish line
thanks
Size int64 `json:"size"` | ||
Path string `json:"path,omitempty"` | ||
Size int64 `json:"size"` | ||
IsStored bool `json:"isStored"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add an errorOnStoreCode int
json:"errorOnStore"field and an
errorOnStoreMsg string json:"errorOnStoreMsg"
field
that way we can tell if
- an attempt to store has not yet completed
- the store was successful
- the store failed on an error
- the precise error is retryable or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems a better idea. Should I replace IsStored
or add these new fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep IsStored and add the other two
- adding log stored stored status explictly in the Log object improves the detection for partial or no storage of logs - it might help mitigate the race condition between pruning the runs and storing the logs. Signed-off-by: Avinal Kumar <[email protected]> rh-pre-commit.version: 2.2.0 rh-pre-commit.check-secrets: ENABLED
The following is the coverage report on the affected files.
|
@avinal: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Changes
Signed-off-by: Avinal Kumar [email protected]
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you review them:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes