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

storage/sql: use isolation level "serializable" for transactions #654

Merged
merged 3 commits into from
Nov 1, 2016

Conversation

ericchiang
Copy link
Contributor

@ericchiang ericchiang commented Nov 1, 2016

Still need to test this with the kubernetes third party resources.

closes #628
closes #600

@ericchiang ericchiang force-pushed the dev-sql-optimistic-concurrency branch from 8f5a455 to 1b85d23 Compare November 1, 2016 00:38
// Same error as Kubernetes.
return errors.New("the object has been modified; please apply your changes to the latest version and try again")
default:
return fmt.Errorf("multiple rows updated: %v", err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

woops, this is the wrong format string

@ericchiang ericchiang force-pushed the dev-sql-optimistic-concurrency branch 2 times, most recently from 0204d10 to 27f6464 Compare November 1, 2016 03:57
@ericchiang
Copy link
Contributor Author

wow, this works with kubernetes as well

$ env | grep DEX_
DEX_POSTGRES_HOST=172.16.28.4
DEX_KUBECONFIG=/home/eric/src/github.com/coreos/coreos-baremetal/examples/assets/tls/kubeconfig
$ go test -v -race github.com/coreos/dex/storage/...
?       github.com/coreos/dex/storage   [no test files]
?       github.com/coreos/dex/storage/conformance   [no test files]
=== RUN   TestIDToName
--- PASS: TestIDToName (0.01s)
=== RUN   TestNamespaceFromServiceAccountJWT
--- PASS: TestNamespaceFromServiceAccountJWT (0.00s)
=== RUN   TestLoadClient
2016/10/31 20:57:59 third party resource already created "auth-code.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "auth-request.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "o-auth2-client.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "signing-key.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "refresh-token.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "password.oidc.coreos.com"
--- PASS: TestLoadClient (0.11s)
=== RUN   TestURLFor
--- PASS: TestURLFor (0.00s)
=== RUN   TestStorage
2016/10/31 20:57:59 third party resource already created "auth-code.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "auth-request.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "o-auth2-client.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "signing-key.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "refresh-token.oidc.coreos.com"
2016/10/31 20:57:59 third party resource already created "password.oidc.coreos.com"
=== RUN   TestStorage/AuthCodeCRUD
=== RUN   TestStorage/AuthRequestCRUD
=== RUN   TestStorage/ClientCRUD
=== RUN   TestStorage/RefreshTokenCRUD
=== RUN   TestStorage/PasswordCRUD
=== RUN   TestStorage/KeysCRUD
=== RUN   TestStorage/GarbageCollection
=== RUN   TestStorage/AuthRequestConcurrentUpdate
=== RUN   TestStorage/ClientConcurrentUpdate
=== RUN   TestStorage/PasswordConcurrentUpdate
=== RUN   TestStorage/KeysConcurrentUpdate
--- PASS: TestStorage (0.53s)
    --- PASS: TestStorage/AuthCodeCRUD (0.03s)
    --- PASS: TestStorage/AuthRequestCRUD (0.03s)
    --- PASS: TestStorage/ClientCRUD (0.04s)
    --- PASS: TestStorage/RefreshTokenCRUD (0.02s)
    --- PASS: TestStorage/PasswordCRUD (0.05s)
    --- PASS: TestStorage/KeysCRUD (0.04s)
    --- PASS: TestStorage/GarbageCollection (0.06s)
    --- PASS: TestStorage/AuthRequestConcurrentUpdate (0.03s)
    --- PASS: TestStorage/ClientConcurrentUpdate (0.04s)
    --- PASS: TestStorage/PasswordConcurrentUpdate (0.04s)
    --- PASS: TestStorage/KeysConcurrentUpdate (0.04s)
PASS
ok      github.com/coreos/dex/storage/kubernetes    1.669s
?       github.com/coreos/dex/storage/kubernetes/k8sapi [no test files]
=== RUN   TestStorage
=== RUN   TestStorage/AuthCodeCRUD
=== RUN   TestStorage/AuthRequestCRUD
=== RUN   TestStorage/ClientCRUD
=== RUN   TestStorage/RefreshTokenCRUD
=== RUN   TestStorage/PasswordCRUD
=== RUN   TestStorage/KeysCRUD
=== RUN   TestStorage/GarbageCollection
--- PASS: TestStorage (0.03s)
    --- PASS: TestStorage/AuthCodeCRUD (0.00s)
    --- PASS: TestStorage/AuthRequestCRUD (0.00s)
    --- PASS: TestStorage/ClientCRUD (0.00s)
    --- PASS: TestStorage/RefreshTokenCRUD (0.00s)
    --- PASS: TestStorage/PasswordCRUD (0.03s)
    --- PASS: TestStorage/KeysCRUD (0.00s)
    --- PASS: TestStorage/GarbageCollection (0.00s)
=== RUN   TestStaticClients
--- PASS: TestStaticClients (0.00s)
PASS
ok      github.com/coreos/dex/storage/memory    1.049s
=== RUN   TestSQLite3
=== RUN   TestSQLite3/AuthCodeCRUD
=== RUN   TestSQLite3/AuthRequestCRUD
=== RUN   TestSQLite3/ClientCRUD
=== RUN   TestSQLite3/RefreshTokenCRUD
=== RUN   TestSQLite3/PasswordCRUD
=== RUN   TestSQLite3/KeysCRUD
=== RUN   TestSQLite3/GarbageCollection
--- PASS: TestSQLite3 (0.20s)
    --- PASS: TestSQLite3/AuthCodeCRUD (0.02s)
    --- PASS: TestSQLite3/AuthRequestCRUD (0.02s)
    --- PASS: TestSQLite3/ClientCRUD (0.02s)
    --- PASS: TestSQLite3/RefreshTokenCRUD (0.03s)
    --- PASS: TestSQLite3/PasswordCRUD (0.05s)
    --- PASS: TestSQLite3/KeysCRUD (0.03s)
    --- PASS: TestSQLite3/GarbageCollection (0.02s)
=== RUN   TestPostgres
=== RUN   TestPostgres/AuthCodeCRUD
=== RUN   TestPostgres/AuthRequestCRUD
=== RUN   TestPostgres/ClientCRUD
=== RUN   TestPostgres/RefreshTokenCRUD
=== RUN   TestPostgres/PasswordCRUD
=== RUN   TestPostgres/KeysCRUD
=== RUN   TestPostgres/GarbageCollection
=== RUN   TestPostgres/AuthRequestConcurrentUpdate
=== RUN   TestPostgres/ClientConcurrentUpdate
=== RUN   TestPostgres/PasswordConcurrentUpdate
=== RUN   TestPostgres/KeysConcurrentUpdate
--- PASS: TestPostgres (0.28s)
    --- PASS: TestPostgres/AuthCodeCRUD (0.02s)
    --- PASS: TestPostgres/AuthRequestCRUD (0.02s)
    --- PASS: TestPostgres/ClientCRUD (0.02s)
    --- PASS: TestPostgres/RefreshTokenCRUD (0.01s)
    --- PASS: TestPostgres/PasswordCRUD (0.03s)
    --- PASS: TestPostgres/KeysCRUD (0.03s)
    --- PASS: TestPostgres/GarbageCollection (0.03s)
    --- PASS: TestPostgres/AuthRequestConcurrentUpdate (0.02s)
    --- PASS: TestPostgres/ClientConcurrentUpdate (0.02s)
    --- PASS: TestPostgres/PasswordConcurrentUpdate (0.04s)
    --- PASS: TestPostgres/KeysConcurrentUpdate (0.04s)
=== RUN   TestDecoder
--- PASS: TestDecoder (0.00s)
=== RUN   TestEncoder
--- PASS: TestEncoder (0.00s)
=== RUN   TestMigrate
--- PASS: TestMigrate (0.02s)
=== RUN   TestTranslate
--- PASS: TestTranslate (0.00s)
PASS
ok      github.com/coreos/dex/storage/sql   1.508s

@ericchiang ericchiang force-pushed the dev-sql-optimistic-concurrency branch from 27f6464 to 786e12b Compare November 1, 2016 06:02
@ericchiang ericchiang changed the title storage/sql: use a "resource version" column for optimistic concurrency storage/sql: use isolation level "serializable" for transactions Nov 1, 2016
@ericchiang ericchiang merged commit 2a9051c into dexidp:dev Nov 1, 2016
@ericchiang ericchiang deleted the dev-sql-optimistic-concurrency branch November 22, 2016 20:07
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.

1 participant