-
Notifications
You must be signed in to change notification settings - Fork 12
feat: enforce TiDB Cloud free plan limits #785
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
Open
srstack
wants to merge
32
commits into
main
Choose a base branch
from
feat/tidbcloud-free-plan-limits
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
e80f710
refactor: add typed TiDB Cloud API errors
srstack e5073a3
refactor: map TiDB Cloud errors by type
srstack fe5252a
refactor: use typed TiDB Cloud upstream errors
srstack afb55c0
feat: unify TiDB Cloud OpenAPI metrics
srstack 2990c67
feat: resolve TiDB Cloud billing plans
srstack ab4f051
feat: validate shared TiDB Cloud billing access
srstack f1999a8
feat: cache non-free TiDB Cloud plans
srstack 99f2245
feat: configure TiDB Cloud free quotas
srstack 5370b61
feat: track tenant billing organizations
srstack c718cd6
feat: resolve TiDB Cloud access profiles
srstack c6201e7
feat: restrict free TiDB Cloud control plane access
srstack 8582042
feat: reserve TiDB Cloud free tenant slots
srstack 39b47bb
feat: enforce free limits on shared tenants
srstack 6c667e0
feat: persist native cluster references before metadata wait
srstack da42a54
refactor: remove legacy native provision interfaces
srstack 645b0c1
feat: reconcile stale free tenant reservations
srstack dbd4152
fix: address TiDB Cloud free plan review findings
srstack 4d42871
fix: raise default free tenant limit to five
srstack 5935bd6
fix: simplify TiDB Cloud free quota accounting
srstack 3a460f1
Merge remote-tracking branch 'origin/main' into feat/tidbcloud-free-p…
srstack 4466c6e
fix: preserve IAM status on body drain errors
srstack 7260410
Merge remote-tracking branch 'origin/main' into feat/tidbcloud-free-p…
srstack 9cb3165
fix: address free-plan review and main conflicts
srstack 0fae3fb
Merge origin/main and fix latest review findings
srstack 74685e4
Merge origin/main into feat/tidbcloud-free-plan-limits
srstack 0df7fed
Merge origin/main into feat/tidbcloud-free-plan-limits
srstack 4179574
Merge origin/main and fix flaky notify coalescer test
srstack 94148ff
Merge origin/main into feat/tidbcloud-free-plan-limits
srstack 36a30b9
Merge remote-tracking branch 'origin/main' into feat/tidbcloud-free-p…
srstack 4122bde
fix: address remaining TiDB Cloud review findings
srstack 6d11171
refactor: reuse TiDB Cloud access profiles
srstack e145c40
chore: adjust TiDB Cloud free quota defaults
srstack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package meta | ||
|
|
||
| import ( | ||
| "context" | ||
| "database/sql" | ||
| "database/sql/driver" | ||
| "errors" | ||
| "fmt" | ||
| "sync/atomic" | ||
| "testing" | ||
| ) | ||
|
|
||
| var finalizeRowsAffectedDriverSequence atomic.Int64 | ||
|
|
||
| type finalizeRowsAffectedErrorDriver struct { | ||
| err error | ||
| } | ||
|
|
||
| func (d finalizeRowsAffectedErrorDriver) Open(string) (driver.Conn, error) { | ||
| return finalizeRowsAffectedErrorConn(d), nil | ||
| } | ||
|
|
||
| type finalizeRowsAffectedErrorConn struct { | ||
| err error | ||
| } | ||
|
|
||
| func (c finalizeRowsAffectedErrorConn) Prepare(string) (driver.Stmt, error) { | ||
| return nil, errors.New("prepare is not supported") | ||
| } | ||
|
|
||
| func (c finalizeRowsAffectedErrorConn) Close() error { return nil } | ||
|
|
||
| func (c finalizeRowsAffectedErrorConn) Begin() (driver.Tx, error) { | ||
| return nil, errors.New("transactions are not supported") | ||
| } | ||
|
|
||
| func (c finalizeRowsAffectedErrorConn) ExecContext(context.Context, string, []driver.NamedValue) (driver.Result, error) { | ||
| return finalizeRowsAffectedErrorResult(c), nil | ||
| } | ||
|
|
||
| type finalizeRowsAffectedErrorResult struct { | ||
| err error | ||
| } | ||
|
|
||
| func (r finalizeRowsAffectedErrorResult) LastInsertId() (int64, error) { return 0, nil } | ||
|
|
||
| func (r finalizeRowsAffectedErrorResult) RowsAffected() (int64, error) { return 0, r.err } | ||
|
|
||
| func TestFinalizeTenantConnectionReturnsRowsAffectedError(t *testing.T) { | ||
| wantErr := errors.New("rows affected unavailable") | ||
| driverName := fmt.Sprintf("finalize-rows-affected-error-%d", finalizeRowsAffectedDriverSequence.Add(1)) | ||
| sql.Register(driverName, finalizeRowsAffectedErrorDriver{err: wantErr}) | ||
| db, err := sql.Open(driverName, "") | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| t.Cleanup(func() { _ = db.Close() }) | ||
|
|
||
| s := &Store{db: db} | ||
| updated, err := s.FinalizeTenantConnection(context.Background(), "tenant-1", TenantPending, TenantProvisioning, &Tenant{}) | ||
| if updated || !errors.Is(err, wantErr) { | ||
| t.Fatalf("FinalizeTenantConnection updated=%v err=%v, want false and rows-affected error", updated, err) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.