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

chore(db) remove pre-workspace blue-green deployment workaround #8896

Merged
merged 1 commit into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@

### Breaking Changes

- Blue-green deployment from Kong earlier than `2.1.0` is not supported, upgrade to
`2.1.0` or later before upgrading to `3.0.0` to have blue-green deployment.
Thank you [@marc-charpentier]((https://github.com/charpentier)) for reporting issue
and proposing a pull-request.
[#8896](https://github.com/Kong/kong/pull/8896)
- Deprecate/stop producing Amazon Linux (1) containers and packages (EOLed December 31, 2020)
[Kong/docs.konghq.com #3966](https://github.com/Kong/docs.konghq.com/pull/3966)
- Deprecate/stop producing Debian 8 "Jessie" containers and packages (EOLed June 2020)
Expand Down
35 changes: 0 additions & 35 deletions kong/db/dao/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -361,39 +361,4 @@ function Plugins:get_handlers()
end


function Plugins:select_by_cache_key(key)

-- first try new way
local entity, new_err = self.super.select_by_cache_key(self, key)

if not new_err then -- the step above didn't fail
-- we still need to check whether the migration is done,
-- because the new table may be only partially full
local schema_state = assert(self.db:schema_state())

-- if migration is complete, disable this translator function and return
if schema_state:is_migration_executed("core", "009_200_to_210") then
Plugins.select_by_cache_key = self.super.select_by_cache_key
return entity
end
end

key = key:sub(1, -38) -- strip ":<ws_id>" from the end

-- otherwise, we either have not started migrating, or we're migrating but
-- the plugin identified by key doesn't have a cache_key yet
-- do things "the old way" in both cases
local row, old_err = self.super.select_by_cache_key(self, key)
if row then
return self:row_to_entity(row)
end

-- when both ways have failed, return the "new" error message.
-- otherwise, only return an error if the "old" version failed.
local err = (new_err and old_err) and new_err or old_err

return nil, err
end


return Plugins