Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge "enhance storage quota error handling." into services-r9

  • Loading branch information...
commit c15444afe6347c03309db6511009c2ea9410346f 2 parents ecedb7f + 9b0ef18
@andl andl authored Gerrit Code Review committed
Showing with 16 additions and 12 deletions.
  1. +16 −12 mysql/lib/mysql_service/storage_quota.rb
View
28 mysql/lib/mysql_service/storage_quota.rb
@@ -87,19 +87,23 @@ def enforce_storage_quota
sizes = dbs_size(connection)
end
ProvisionedService.all.each do |service|
- db, user, quota_exceeded = service.name, service.user, service.quota_exceeded
- size = sizes[db]
- # ignore the orphan instance
- next if size.nil?
+ begin
+ db, user, quota_exceeded = service.name, service.user, service.quota_exceeded
+ size = sizes[db]
+ # ignore the orphan instance
+ next if size.nil?
- if (size >= @max_db_size) and not quota_exceeded then
- revoke_write_access(db, service)
- @logger.info("Storage quota exceeded :" + fmt_db_listing(user, db, size) +
- " -- access revoked")
- elsif (size < @max_db_size) and quota_exceeded then
- grant_write_access(db, service)
- @logger.info("Below storage quota:" + fmt_db_listing(user, db, size) +
- " -- access restored")
+ if (size >= @max_db_size) and not quota_exceeded then
+ revoke_write_access(db, service)
+ @logger.info("Storage quota exceeded :" + fmt_db_listing(user, db, size) +
+ " -- access revoked")
+ elsif (size < @max_db_size) and quota_exceeded then
+ grant_write_access(db, service)
+ @logger.info("Below storage quota:" + fmt_db_listing(user, db, size) +
+ " -- access restored")
+ end
+ rescue => e1
+ @logger.warn("Fail to enfroce storage quota on #{service.name}: #{e1}" + e1.backtrace.join("|") )
end
end
rescue Mysql2::Error => e
Please sign in to comment.
Something went wrong with that request. Please try again.