Permalink
Browse files

revise app for mongodb storage quota yeti case

Change-Id: Ic72a3950a1cd46d10ee1abb35633b2018cddcc1a
  • Loading branch information...
1 parent d8619cd commit c1ccd1c943da397ce5bb4914426777d01e377382 Chunjie committed Nov 19, 2012
Showing with 15 additions and 5 deletions.
  1. +15 −5 sinatra/app_sinatra_service_quota/main.rb
@@ -120,9 +120,11 @@
puts col.count()
end
return last_error['err']
- #if reach quota_files limit, should be "db disk space quota exceeded db"
rescue Exception => e
puts e.message
+ # proxy will drop the connection if 'Quota Exceed', the error message
+ # contains keyword 'Connection reset by peer'
+ return e.message
end
end
@@ -141,17 +143,25 @@
delete '/service/mongodb/collection' do
client = load_mongodb
begin
- col = client[params[:colname]]
- params[:size].to_i.times do |i|
- col.remove({"name"=>"mongo#{i}"})
- end
+ client.drop_collection(params[:colname])
client.close
rescue Exception => e
puts e.message
end
"DELETE OK"
end
+post "/service/mongodb/maintain" do
+ client = load_mongodb
+ begin
+ client.command({:repairDatabase => 1})
+ client.close
+ rescue Exception => e
+ puts e.message
+ end
+ "REPAIR OK"
+end
+
post '/service/mysql/tables/:table' do
client = load_mysql
begin

0 comments on commit c1ccd1c

Please sign in to comment.