-
Notifications
You must be signed in to change notification settings - Fork 331
Fix concurrency errors that could cause corruption or dropped updates #1092
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
Changes from all commits
119f445
2e77013
a05f419
7acf52b
94d68e6
8bd53ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.extension.persistence.impl.eclipselink; | ||
|
|
||
| import org.eclipse.persistence.sessions.DatabaseLogin; | ||
| import org.eclipse.persistence.sessions.Session; | ||
| import org.eclipse.persistence.sessions.SessionCustomizer; | ||
|
|
||
| /** | ||
| * This pattern of injecting a SessionCustomizer is taken from the EclipseLink guide documentation: | ||
| * | ||
| * <p>https://eclipse.dev/eclipselink/documentation/2.6/dbws/creating_dbws_services002.htm | ||
| */ | ||
| public class PolarisEclipseLinkSessionCustomizer implements SessionCustomizer { | ||
| @Override | ||
| public void customize(Session session) throws Exception { | ||
| DatabaseLogin databaseLogin = (DatabaseLogin) session.getDatasourceLogin(); | ||
| databaseLogin.setTransactionIsolation(DatabaseLogin.TRANSACTION_SERIALIZABLE); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # This contains the postgres config settings provided to the startup command | ||
| # as "postgres -c config_file=<this file>". | ||
| # | ||
| # See https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample | ||
| # for more config options. | ||
|
|
||
| # Required standard settings normally specified in default config | ||
| listen_addresses = '*' | ||
| max_connections = 100 | ||
|
|
||
| shared_buffers = 128MB | ||
| dynamic_shared_memory_type = posix | ||
|
|
||
| max_wal_size = 1GB | ||
| min_wal_size = 80MB | ||
|
Comment on lines
+31
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these just defaults, or where did these come from?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah they were in the postgres docker image. Originally I copy pasted the whole file but it was too cluttered so I just literally filtered to keep only the non-commented-out default settings. |
||
|
|
||
| log_timezone = 'Etc/UTC' | ||
| datestyle = 'iso, mdy' | ||
| timezone = 'Etc/UTC' | ||
|
|
||
|
|
||
| # Custom settings below | ||
|
|
||
| # NOTE: It's best practice to explicitly set the isolation level from the | ||
| # application layer where possible, but in some cases this requires careful | ||
| # configuration to inject settings into JPA frameworks. This is provided here | ||
| # for defense-in-depth and for illustrative purposes if database customization | ||
| # is desired. | ||
| default_transaction_isolation = 'serializable' | ||
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.
Good point. I guess that might be the reason for 500 errors in my old test with Serializable isolation.