-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Drop tag definition constraint #6582
base: master
Are you sure you want to change the base?
Changes from all commits
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,4 @@ | ||
--- | ||
type: perf | ||
issue: 6582 | ||
title: "Under heavy load, a foreign key constraint in the Tag Definition table (used for Tags, Security Labels, and Profile Definitions) can cause serious slowdowns when writing large numbers of resources (particularly if many resources contain the same tags/labels, or if the resources are being written individually or in smaller batches). This has been corrected." |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,12 +26,15 @@ | |
import org.apache.commons.lang3.Validate; | ||
import org.apache.commons.lang3.builder.EqualsBuilder; | ||
import org.apache.commons.lang3.builder.HashCodeBuilder; | ||
import org.intellij.lang.annotations.Language; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Set; | ||
|
||
import static org.apache.commons.lang3.StringUtils.isNotBlank; | ||
|
@@ -92,14 +95,18 @@ public void validate() { | |
public void doExecute() throws SQLException { | ||
|
||
Set<String> existing = JdbcUtils.getForeignKeys(getConnectionProperties(), myParentTableName, getTableName()); | ||
if (!existing.contains(myConstraintName)) { | ||
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. suggestion: this can be tested now. See AddIndexTaskITTestSuite for an example. |
||
if (!existing.contains(myConstraintName.toUpperCase(Locale.US))) { | ||
logInfo(ourLog, "Don't have constraint named {} - No action performed", myConstraintName); | ||
return; | ||
} | ||
|
||
List<String> sqls = generateSql(getTableName(), myConstraintName, getDriverType()); | ||
List<String> sqlStatements; | ||
try (Connection connection = getConnectionProperties().getDataSource().getConnection()) { | ||
String constraintName = JdbcUtils.massageIdentifier(connection.getMetaData(), myConstraintName); | ||
sqlStatements = generateSql(getTableName(), constraintName, getDriverType()); | ||
} | ||
|
||
for (String next : sqls) { | ||
for (@Language("SQL") String next : sqlStatements) { | ||
executeSql(getTableName(), next); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2528,6 +2528,11 @@ | |
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>3.8.1</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>3.1.3</version> | ||
</plugin> | ||
Comment on lines
+2531
to
+2535
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. question: What's this for? 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. This is unrelated, just noticed that there was a warning on every build because we use this plugin but don't pin a version. |
||
<plugin> | ||
<groupId>org.sonatype.plugins</groupId> | ||
<artifactId>nexus-staging-maven-plugin</artifactId> | ||
|
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.
question: do you want to do this for all dbs, or just postgres?