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

fix(sqlExecutionRepo): Return compressed columns when enabled for retrieve pipelines with configId (backport #4765) #4766

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jul 16, 2024

When execution repository compression is enabled the generated query for retrieving the pipelines with configId was not returning the compressed columns from the left outer join.

Orca was failing with:

org.jooq.exception.DataAccessException: SQL [select id, body, compressed_body, compression_type, `partition` from pipelines join (select id from pipelines left outer join pipelines_compressed_executions using (id) where (config_id in (?, ?) and build_time > ? and build_time < ?) order by build_time asc limit ? offset ?) as `alias_79833741` using (id) order by build_time asc]; Unknown column 'compressed_body' in 'field list'
	at app//org.jooq.impl.Tools.translate(Tools.java:2903)
	at app//org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:757)
	at app//org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:389)
	at app//org.jooq.impl.AbstractResultQuery.fetch(AbstractResultQuery.java:337)
	at app//org.jooq.impl.SelectImpl.fetch(SelectImpl.java:2880)
	at app//com.netflix.spinnaker.orca.sql.pipeline.persistence.SqlExecutionRepository.fetchExecutions(SqlExecutionRepository.kt:1208)
	at app//com.netflix.spinnaker.orca.sql.pipeline.persistence.SqlExecutionRepository.retrievePipelinesForPipelineConfigIdsBetweenBuildTimeBoundary(SqlExecutionRepository.kt:712)
	at app//com.netflix.spinnaker.orca.sql.pipeline.persistence.SqlExecutionRepository.retrieveAllPipelinesForPipelineConfigIdsBetweenBuildTimeBoundary(SqlExecutionRepository.kt:728)
	at app//com.netflix.spinnaker.kork.telemetry.InstrumentedProxy.invoke(InstrumentedProxy.java:103)
	at com.netflix.spinnaker.orca.sql.pipeline.persistence.SqlPipelineExecutionRepositorySpec.can retrieve ALL pipelines by configIds between build time boundaries(SqlPipelineExecutionRepositorySpec.groovy:648)
Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'compressed_body' in 'field list'
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:121)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916)
	at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
	at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:214)
	at org.jooq.impl.Tools.executeStatementAndGetFirstResultSet(Tools.java:4217)
	at org.jooq.impl.AbstractResultQuery.execute(AbstractResultQuery.java:283)
	at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:375)
	... 7 more

This PR fixes the issue and add tests to demonstrate the bug


This is an automatic backport of pull request #4765 done by Mergify.

…rieve pipelines with configId (#4765)

(cherry picked from commit ccaeb0a)

# Conflicts:
#	orca-sql/src/test/groovy/com/netflix/spinnaker/orca/sql/pipeline/persistence/SqlPipelineExecutionRepositorySpec.groovy
@mergify mergify bot added the conflicts label Jul 16, 2024
Copy link
Contributor Author

mergify bot commented Jul 16, 2024

Cherry-pick of ccaeb0a has failed:

On branch mergify/bp/release-1.34.x/pr-4765
Your branch is up to date with 'origin/release-1.34.x'.

You are currently cherry-picking commit ccaeb0ac9.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   orca-sql/src/main/kotlin/com/netflix/spinnaker/orca/sql/pipeline/persistence/SqlExecutionRepository.kt

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   orca-sql/src/test/groovy/com/netflix/spinnaker/orca/sql/pipeline/persistence/SqlPipelineExecutionRepositorySpec.groovy

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@ovidiupopa07 ovidiupopa07 added ready to merge Approved and ready for merge and removed conflicts labels Jul 17, 2024
@ovidiupopa07 ovidiupopa07 merged commit 6908461 into release-1.34.x Jul 17, 2024
2 checks passed
@mergify mergify bot deleted the mergify/bp/release-1.34.x/pr-4765 branch July 17, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Approved and ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants