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

Add log stored status explicitly #760

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

khrm
Copy link
Contributor

@khrm khrm commented Jun 6, 2024

  • 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.

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user-facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jun 6, 2024
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 6, 2024
Copy link
Contributor Author

@khrm khrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tekton-robot
Copy link

@khrm: GitHub didn't allow me to assign the following users: gabemontero.

Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @gabemontero @enarha

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.


import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)

// LogRecordType represents the API resource type for Tekton log records.
const LogRecordType = "results.tekton.dev/v1alpha2.Log"
const LogRecordType = "results.tekton.dev/v1alpha3.Log"
const LogRecordTypeV2 = "results.tekton.dev/v1alpha2.Log"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this also because some of the Type stored in DB can be v2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack @khrm good catch

func ToStream(ctx context.Context, record *db.Record, config *config.Config) (Stream, *v1alpha2.Log, error) {
if record.Type != v1alpha2.LogRecordType {
func ToStream(ctx context.Context, record *db.Record, config *config.Config) (Stream, *v1alpha3.Log, error) {
if record.Type != v1alpha3.LogRecordType || record.Type != v1alpha3.LogRecordTypeV2 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need V2 here because it can be v2 also. So I added that,

Copy link
Contributor Author

@khrm khrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 6, 2024
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/logs.go 63.4% 50.7% -12.7
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 25.0%
pkg/apis/v1alpha3/types.go Do not exist 75.0%

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/logs.go 63.4% 50.7% -12.7
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 100.0%
pkg/apis/v1alpha3/types.go Do not exist 66.7%

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/logs.go 63.4% 50.7% -12.7
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 100.0%
pkg/apis/v1alpha3/types.go Do not exist 66.7%

@khrm khrm force-pushed the log-status branch 2 times, most recently from 4b5450e to 28d50ea Compare June 6, 2024 11:55
@khrm
Copy link
Contributor Author

khrm commented Jun 6, 2024

/test pull-tekton-results-build-tests

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/logs.go 63.4% 50.7% -12.7
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 100.0%
pkg/apis/v1alpha3/types.go Do not exist 66.7%

@khrm
Copy link
Contributor Author

khrm commented Jun 6, 2024

/test pull-tekton-results-unit-tests

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/logs.go 63.4% 66.2% 2.8
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 66.7%
pkg/apis/v1alpha3/types.go Do not exist 50.0%

@khrm
Copy link
Contributor Author

khrm commented Jun 6, 2024

/test pull-tekton-results-integration-tests

@khrm
Copy link
Contributor Author

khrm commented Jun 6, 2024

/test pull-tekton-results-build-tests

@khrm
Copy link
Contributor Author

khrm commented Jun 6, 2024

/test pull-tekton-results-unit-tests

Copy link
Contributor Author

@khrm khrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/assign @gabemontero

@tekton-robot
Copy link

@khrm: GitHub didn't allow me to assign the following users: gabemontero.

Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @gabemontero

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.

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/logs.go 63.4% 62.6% -0.8
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 100.0%
pkg/apis/v1alpha3/types.go Do not exist 100.0%
pkg/apis/v1alpha3/types.go Do not exist 66.7%

Copy link
Contributor Author

@khrm khrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/assign @gabemontero

@tekton-robot
Copy link

@khrm: GitHub didn't allow me to assign the following users: gabemontero.

Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @gabemontero

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.

@khrm
Copy link
Contributor Author

khrm commented Jun 6, 2024

/hold I am testing various scenarios atm. I will cancel the hold tomorrow after I finish testing.

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 6, 2024
Path string `json:"path,omitempty"`
Size int64 `json:"size"`
IsStored bool `json:"isStored"`
ErrorOnStoreMsg string `json:"errorOnStoreMsg"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah per my comment https://github.com/tektoncd/results/pull/704/files#r1630064603 @khrm lets add an errorOnStoreCode int as well

@avinal @sayan-biswas fyi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we use errorcode for streaming? We aren't using grpc code during streaming.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khrm consider the old prototype for using this change over in #713

I want that call in the watcher's dynamic.go to not just check if it is stored, and if it is not, requeue to consider pruning later.

I want it to also see that if it is not stored per the update made in pkg/api/server/v1alpha2/logs.go 's handleReturn (where it has the original "error"), but because of an error on the api server side, to see if the particular error is one of the grpc intermittent sort of hiccups that mean we can re-attempt the log storage.

In this way, we finally address the lack of retry on error that @sayan-biswas @avinal @enarha and myself have lamented for months.

Now, if there is some flaw in the way I've connected the dots here, then let's you @khrm, myself, @avinal @sayan-biswas @enarha discuss either here on in the next WG call.

As a backup, I'm also fine with setting a boolean "IsRetrablyErrorOccurred" field. in LogStatus, have the handleReturn code make the decision if the error that occured in an intermittent, retryable sort of thing, and then the dynamic.go code works off of that to try the UpdateLog call again.

thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a new field for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @khrm thanks

@enarha @avinal @sayan-biswas as I am not in the OWNERS file anywhere, we need reviews from you all to get this finally merged.

PTAL

Copy link
Contributor

@gabemontero gabemontero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just the one additional field on the LogStatus obj @khrm

thanks

@khrm
Copy link
Contributor Author

khrm commented Jun 10, 2024

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 10, 2024
@khrm
Copy link
Contributor Author

khrm commented Jun 10, 2024

I have also tested the following scenarios now:

  • Creating Prs with older results release.
  • We are upgrading to newer results and checking whether we can access v2alpha logs.
  • Creating PRs with this results release. I was able to access those logs.

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/logs.go 63.4% 62.3% -1.1
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 66.7%
pkg/apis/v1alpha3/types.go Do not exist 75.0%

- 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 <avinal@redhat.com>

Signed-off-by: Khurram Baig <kbaig@redhat.com>
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-results-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/logs.go 63.4% 62.3% -1.1
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 50.0%
pkg/apis/v1alpha3/types.go Do not exist 100.0%
pkg/apis/v1alpha3/types.go Do not exist 66.7%

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: gabemontero
To complete the pull request process, please ask for approval from enarha after the PR has been reviewed.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants