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

Purge varnish items with "cdb_tablemetadata" channel on table update #308

Merged
merged 1 commit into from
Dec 10, 2013
Merged
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
13 changes: 12 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,18 @@ def create_function_invalidate_varnish
break

try:
client.fetch('#{purge_command} obj.http.X-Cache-Channel ~ "^#{self.database_name}:(.*%s.*)|(table)$"' % table_name)
# NOTE: every table change also changed CDB_TableMetadata, so
# we purge those entries too
#
# TODO: check if any server is ever setting "table" as the
# surrogate key, as that looks redundant to me
# --strk-20131203;
#
# TODO: do not invalidate responses with surrogate key
# "not_this_one" when table "this" changes :/
# --strk-20131203;
#
client.fetch('#{purge_command} obj.http.X-Cache-Channel ~ "^#{self.database_name}:(.*%s.*)|(cdb_tablemetadata)|(table)$"' % table_name)
break
except Exception as err:
plpy.warning('Varnish fetch error: ' + str(err))
Expand Down