Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Merge "remove explict vacuum full when below quota"
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Lu authored and Gerrit Code Review committed Nov 28, 2012
2 parents f25fa5f + c68bd80 commit d7a897b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ng/postgresql/lib/postgresql_service/node.rb
Expand Up @@ -377,7 +377,7 @@ def create_database_user(instance, binduser, quota_exceeded)
#Ignore privileges Initializing error. Log only.
begin
if quota_exceeded then
# revoke create privilege on database to parent role
# revoke create privilege on database from parent role
# In fact, this is a noop, for the create privilege of parent user should be revoked in revoke_write_access when quota is exceeded.
db_connection.query("REVOKE CREATE ON DATABASE #{name} FROM #{user}") unless parent
db_connection.query("REVOKE TEMP ON DATABASE #{name} from #{user}")
Expand Down
2 changes: 1 addition & 1 deletion ng/postgresql/lib/postgresql_service/storage_quota.rb
Expand Up @@ -81,7 +81,7 @@ def enforce_instance_storage_quota(service, database_size=nil)
end
end
rescue => e
@logger.warn("PostgreSQL Node exception: " + fmt_error(e))
@logger.warn("Fail to enforce storage quota for service #{service.name}: " + fmt_error(e))
end
end

Expand Down
16 changes: 6 additions & 10 deletions ng/postgresql/lib/postgresql_service/util.rb
Expand Up @@ -183,15 +183,12 @@ def do_revoke_query(db_connection, user, sys_user)

# Legacy method to grant user privileges of public schema
def exe_grant_user_priv(conn)
@logger ||= create_logger
unless conn
@logger.error("No connection to do exe_grant_user_priv")
return
end
grant_user_priv(conn, pg_version(conn))
end
def grant_user_priv(conn, version)
return unless conn
@logger ||= create_logger
unless conn
@logger.error("No connection to do exe_grant_user_priv")
return
end
version = pg_version(conn)
conn.query("grant create on schema public to public")
if version == '9'
conn.query("grant all on all tables in schema public to public")
Expand Down Expand Up @@ -290,7 +287,6 @@ def grant_write_access_internal(db_connection, service, public_schema_id=nil)
if db_connection_sys_user.nil?
@logger.error("Unable to grant write access to #{name} for #{sys_user}")
else
db_connection_sys_user.query("vacuum full")
db_connection_sys_user.close
do_grant_query(db_connection, user, sys_user)
end
Expand Down

0 comments on commit d7a897b

Please sign in to comment.