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

skip transaction for POST /service/token #19339

Merged

Conversation

liubin
Copy link
Contributor

@liubin liubin commented Sep 12, 2023

Thank you for contributing to Harbor!

Comprehensive Summary of your change

Habor doesnot support POST /service/token endpoint, put this request into a transaction will consume
extra database resources and generate many logs.

Logs in core and nginx:

2023-09-12T10:59:47+08:00 [DEBUG] [/antregistry/src/server/middleware/log/log.go:30]: attach request id aaa37a96-ec65-40f8-821d-6267e8d5f5a6 to the logger for the request POST /service/token
[ORM]2023/09/12 10:59:47  -[Queries/default] - [  OK /  db.BeginTx /     4.3ms] - [START TRANSACTION]
2023-09-12T10:59:47+08:00 [DEBUG] [/antregistry/src/server/middleware/artifactinfo/artifact_info.go:55]: In artifact info middleware, url: /service/token
2023-09-12T10:59:47+08:00 [DEBUG] [/antregistry/src/server/middleware/security/unauthorized.go:28][requestID="aaa37a96-ec65-40f8-821d-6267e8d5f5a6"]: an unauthorized security context generated for request POST /service/token
[ORM]2023/09/12 10:59:47  -[Queries/default] - [  OK / tx.Rollback /     4.6ms] - [ROLLBACK]
2023-09-12T10:59:48+08:00 [DEBUG] [/antregistry/src/server/middleware/log/log.go:30]: attach request id ae9747af-f028-4acf-a86a-db1d96ce9d76 to the logger for the request GET /service/token

[2023-09-12T11:09:33+08:00] 10.2.0.84 - "POST /service/token HTTP/1.1" 405 19 "-" "Go-http-client/1.1" 0.022 0.022 .

Issue being fixed

Fixes #(issue)

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ee6f61c) 45.36% compared to head (d2a089d) 45.33%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #19339      +/-   ##
==========================================
- Coverage   45.36%   45.33%   -0.03%     
==========================================
  Files         244      244              
  Lines       13333    13333              
  Branches     2720     2720              
==========================================
- Hits         6048     6045       -3     
- Misses       6984     6987       +3     
  Partials      301      301              
Flag Coverage Δ
unittests 45.33% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 3 files with indirect coverage changes

Copy link
Member

@Vad1mo Vad1mo left a comment

Choose a reason for hiding this comment

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

makes sense

@Vad1mo Vad1mo enabled auto-merge (squash) October 23, 2023 09:53
@Vad1mo Vad1mo added release-note/update Update or Fix release-note/enhancement Label to mark PR to be added under release notes as enhancement labels Oct 23, 2023
Copy link

This PR is being marked stale due to a period of inactivty. If this PR is still relevant, please comment or remove the stale label. Otherwise, this PR will close in 30 days.

@github-actions github-actions bot added the Stale label Dec 23, 2023
@stonezdj stonezdj removed the Stale label Jan 19, 2024
@stonezdj stonezdj force-pushed the fix/skip-transaction-for-token-requests branch from 408dd29 to ef3de38 Compare January 19, 2024 01:42
Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

Habor doesnot support POST /service/token endpoint,
put this request into a transaction will consume
extra database resources and generate many logs.

Signed-off-by: bin liu <[email protected]>
@chlins chlins force-pushed the fix/skip-transaction-for-token-requests branch from ef3de38 to d2a089d Compare January 19, 2024 06:20
@Vad1mo Vad1mo merged commit 5a57617 into goharbor:main Jan 19, 2024
11 of 12 checks passed
altynbaev pushed a commit to altynbaev/harbor that referenced this pull request Jan 29, 2024
Habor doesnot support POST /service/token endpoint,
put this request into a transaction will consume
extra database resources and generate many logs.

Signed-off-by: bin liu <[email protected]>
Signed-off-by: Altynbaev Dinislam <[email protected]>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/enhancement Label to mark PR to be added under release notes as enhancement release-note/update Update or Fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants