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 #4765

Conversation

christosarvanitis
Copy link
Member

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

@jasonmcintosh jasonmcintosh added the ready to merge Approved and ready for merge label Jul 16, 2024
@mergify mergify bot added the auto merged Merged automatically by a bot label Jul 16, 2024
@mergify mergify bot merged commit ccaeb0a into spinnaker:master Jul 16, 2024
4 checks passed
@jasonmcintosh
Copy link
Member

@Mergifyio backport release-1.34.x

Copy link
Contributor

mergify bot commented Jul 16, 2024

backport release-1.34.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jul 16, 2024
…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
ovidiupopa07 pushed a commit that referenced this pull request Jul 17, 2024
…rieve pipelines with configId (backport #4765) (#4766)

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

(cherry picked from commit ccaeb0a)

# Conflicts:
#	orca-sql/src/test/groovy/com/netflix/spinnaker/orca/sql/pipeline/persistence/SqlPipelineExecutionRepositorySpec.groovy

* fix(backport): Fix tests on bad backport for search API breakage due to compression changes

---------

Co-authored-by: Christos Arvanitis <christos.arvanitis@armory.io>
Co-authored-by: Jason <jason.mcintosh@harness.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants