filecluster 0.4.10 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/daemon/global_daemon_thread.rb +1 -1
- data/lib/daemon/update_tasks_thread.rb +6 -2
- data/lib/fc/item.rb +1 -0
- data/lib/fc/storage.rb +16 -11
- data/lib/fc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81a8deb986d25028bc35bcaa5e8eae3bd5f2631f
|
4
|
+
data.tar.gz: 5a10c3c2ccf9cbc6a3ad1677afcde8a364571872
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff27684b3bfbc4ecdd2a655db3f8ccd62464d50cdb122c0eb21a20dd83a2431d36895f03b95b75092a474ea89926fab5fd5342b85843f6658bec5d135a962949
|
7
|
+
data.tar.gz: 8d38c5bf40542c5c21ef033d45059cbe8beea14b8aa461182040d2c0733f0b5da6e81d5ee9067b937b9b39a41ea1aceff2ce70b134a9e9d4be672710f884a487
|
@@ -60,7 +60,7 @@ class GlobalDaemonThread < BaseThread
|
|
60
60
|
storage = src_storage.get_proper_storage_for_copy(row['size'], item_storages) unless storage
|
61
61
|
end
|
62
62
|
if storage
|
63
|
-
FC::Item.new(:id => row['item_id']).make_item_storage(storage, 'copy')
|
63
|
+
FC::Item.new(:id => row['item_id'], :size => row['size']).make_item_storage(storage, 'copy')
|
64
64
|
else
|
65
65
|
error 'No available storage', :item_id => row['item_id']
|
66
66
|
end
|
@@ -7,12 +7,16 @@ class UpdateTasksThread < BaseThread
|
|
7
7
|
|
8
8
|
def check_tasks(type)
|
9
9
|
count = 0
|
10
|
+
limit = FC::Var.get("daemon_tasks_#{type}_group_limit", 1000).to_i
|
10
11
|
tasks = (type == :copy ? $tasks_copy : $tasks_delete)
|
11
12
|
$storages.each do |storage|
|
12
13
|
tasks[storage.name] = [] unless tasks[storage.name]
|
13
|
-
cond = "storage_name = '#{storage.name}' AND status='#{type.to_s}'"
|
14
14
|
ids = tasks[storage.name].map(&:id) + $curr_tasks.map(&:id)
|
15
|
-
|
15
|
+
if ids.length > limit*2
|
16
|
+
$log.debug("Too many (#{ids.length}) #{type} tasks")
|
17
|
+
next
|
18
|
+
end
|
19
|
+
cond = "storage_name = '#{storage.name}' AND status='#{type.to_s}'"
|
16
20
|
cond << "AND id not in (#{ids.join(',')})" if ids.length > 0
|
17
21
|
cond << " LIMIT #{limit}"
|
18
22
|
FC::ItemStorage.where(cond).each do |item_storage|
|
data/lib/fc/item.rb
CHANGED
data/lib/fc/storage.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'shellwords'
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
5
|
module FC
|
5
6
|
class Storage < DbBase
|
@@ -112,17 +113,21 @@ module FC
|
|
112
113
|
# delete object from storage
|
113
114
|
def delete_file(file_name)
|
114
115
|
dst_path = "#{self.path}#{file_name}"
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
"
|
123
|
-
|
124
|
-
|
125
|
-
|
116
|
+
if self.class.curr_host == host
|
117
|
+
begin
|
118
|
+
File.delete(dst_path)
|
119
|
+
rescue Errno::EISDIR
|
120
|
+
FileUtils.rm_r(dst_path)
|
121
|
+
end
|
122
|
+
else
|
123
|
+
cmd = "ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"rm -rf #{dst_path.shellescape}\""
|
124
|
+
r = `#{cmd} 2>&1`
|
125
|
+
raise r if $?.exitstatus != 0
|
126
|
+
|
127
|
+
cmd = "ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"ls -la #{dst_path.shellescape}\""
|
128
|
+
r = `#{cmd} 2>/dev/null`
|
129
|
+
raise "Path #{dst_path} not deleted" unless r.empty?
|
130
|
+
end
|
126
131
|
end
|
127
132
|
|
128
133
|
# return object size on storage
|
data/lib/fc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filecluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|