postmodern 0.3.3 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbecfcf25d7aab04bd19df71c1edd12680eb84a7
4
- data.tar.gz: 3a104d4e01a2297319572ff763345a40da950a9a
3
+ metadata.gz: 5cc8bd6f33e54fa05e60ec743707a9f8cc5b7d33
4
+ data.tar.gz: 3ca5d5fccee9d6301fc3bafe7fe5bd39a7fb7b3e
5
5
  SHA512:
6
- metadata.gz: 7e133e8e11e56f7cb9dd594c9784cefb9311b68216e1656618f9e06b7896bbc4e6955f6606e8a416af86f2c0b348c0889b09233cd3c0f2520c7a49c366d8cdd3
7
- data.tar.gz: 8de3bd8f674ae01174bce7b0046d53473d42b245d2da849ea29f037a392c694055012b77df04bf919987dabd765f16c3a88c91c67d8f34411395bc35810e68d1
6
+ metadata.gz: 2d9a2ba9020b974cae55ae2d05a0f975f44df4c52f316b70fdab2e653d8ed3466679afc03811ae9af03a8bf7dcc14f449155f228337a3f0ad2180395cdd53387
7
+ data.tar.gz: 7665509b394eda825e1d4c4290c0625f1434ae4e28ad97ecf6b5c824a98d25ed392513b338afb22d99a414a56e95bcfa8112b464baf67fa4d8b41514cbfcda8e
data/README.md CHANGED
@@ -40,6 +40,7 @@ Usage: postmodern (vacuum|freeze) <options>
40
40
  -P, --pause PAUSE Pause (minutes) after each table vacuum -- default 10
41
41
  -d, --database DB Database to vacuum. Required.
42
42
 
43
+ -r, --ratio RATIO minimum dead tuple ratio to vacuum -- default 0.05
43
44
  -B, --tablesize BYTES minimum table size to vacuum -- default 1000000
44
45
  -F, --freezeage AGE minimum freeze age -- default 10000000
45
46
  -D, --costdelay DELAY vacuum_cost_delay setting in ms -- default 20
@@ -24,7 +24,7 @@ module Postmodern
24
24
  self.options[:user] = opt
25
25
  end
26
26
 
27
- opts.on('-p', '--port PORT', 'Defaults to 5432') do |opt|
27
+ opts.on('-p', '--port PORT', Integer, 'Defaults to 5432') do |opt|
28
28
  self.options[:port] = opt
29
29
  end
30
30
 
@@ -38,11 +38,11 @@ module Postmodern
38
38
 
39
39
  opts.separator ''
40
40
 
41
- opts.on('-t', '--timeout TIMEOUT', 'Halt after timeout minutes -- default 120') do |opt|
41
+ opts.on('-t', '--timeout TIMEOUT', Integer, 'Halt after timeout minutes -- default 120') do |opt|
42
42
  self.options[:timeout] = opt
43
43
  end
44
44
 
45
- opts.on('-P', '--pause PAUSE', 'Pause (minutes) after each table vacuum -- default 10') do |opt|
45
+ opts.on('-P', '--pause PAUSE', Integer, 'Pause (minutes) after each table vacuum -- default 10') do |opt|
46
46
  self.options[:pause] = opt
47
47
  end
48
48
 
@@ -52,19 +52,23 @@ module Postmodern
52
52
 
53
53
  opts.separator ''
54
54
 
55
- opts.on('-B', '--tablesize BYTES', 'minimum table size to vacuum -- default 1000000') do |opt|
55
+ opts.on('-r', '--ratio RATIO', Float, 'minimum dead tuple ratio to vacuum -- default 0.05') do |opt|
56
+ self.options[:ratio] = opt
57
+ end
58
+
59
+ opts.on('-B', '--tablesize BYTES', Integer, 'minimum table size to vacuum -- default 1000000') do |opt|
56
60
  self.options[:tablesize] = opt
57
61
  end
58
62
 
59
- opts.on('-F', '--freezeage AGE', 'minimum freeze age -- default 10000000') do |opt|
63
+ opts.on('-F', '--freezeage AGE', Integer, 'minimum freeze age -- default 10000000') do |opt|
60
64
  self.options[:freezeage] = opt
61
65
  end
62
66
 
63
- opts.on('-D', '--costdelay DELAY', 'vacuum_cost_delay setting in ms -- default 20') do |opt|
67
+ opts.on('-D', '--costdelay DELAY', Integer, 'vacuum_cost_delay setting in ms -- default 20') do |opt|
64
68
  self.options[:costdelay] = opt
65
69
  end
66
70
 
67
- opts.on('-L', '--costlimit LIMIT', 'vacuum_cost_limit setting -- default 2000') do |opt|
71
+ opts.on('-L', '--costlimit LIMIT', Integer, 'vacuum_cost_limit setting -- default 2000') do |opt|
68
72
  self.options[:costlimit] = opt
69
73
  end
70
74
 
@@ -166,7 +170,7 @@ module Postmodern
166
170
  )
167
171
  SELECT full_table_name
168
172
  FROM deadrow_tables
169
- WHERE dead_pct > 0.05
173
+ WHERE dead_pct > #{options[:ratio]}
170
174
  AND table_bytes > #{options[:tablesize]}
171
175
  ORDER BY dead_pct DESC, table_bytes DESC;
172
176
  SQL
@@ -1,3 +1,3 @@
1
1
  module Postmodern
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -13,6 +13,7 @@ Usage: postmodern (vacuum|freeze) <options>
13
13
  -P, --pause PAUSE Pause (minutes) after each table vacuum -- default 10
14
14
  -d, --database DB Database to vacuum. Required.
15
15
 
16
+ -r, --ratio RATIO minimum dead tuple ratio to vacuum -- default 0.05
16
17
  -B, --tablesize BYTES minimum table size to vacuum -- default 1000000
17
18
  -F, --freezeage AGE minimum freeze age -- default 10000000
18
19
  -D, --costdelay DELAY vacuum_cost_delay setting in ms -- default 20
@@ -13,6 +13,7 @@ Usage: postmodern (vacuum|freeze) <options>
13
13
  -P, --pause PAUSE Pause (minutes) after each table vacuum -- default 10
14
14
  -d, --database DB Database to vacuum. Required.
15
15
 
16
+ -r, --ratio RATIO minimum dead tuple ratio to vacuum -- default 0.05
16
17
  -B, --tablesize BYTES minimum table size to vacuum -- default 1000000
17
18
  -F, --freezeage AGE minimum freeze age -- default 10000000
18
19
  -D, --costdelay DELAY vacuum_cost_delay setting in ms -- default 20
@@ -106,7 +106,7 @@ describe Postmodern::Vacuum::Vacuum do
106
106
  end
107
107
 
108
108
  describe '#tables_to_vacuum' do
109
- let(:args) { %w(-d mydb -B 12345) }
109
+ let(:args) { %w(-d mydb -B 12345 -r 0.12345) }
110
110
 
111
111
  it 'finds list of tables to vacuum' do
112
112
  result = [
@@ -125,7 +125,7 @@ describe Postmodern::Vacuum::Vacuum do
125
125
  )
126
126
  SELECT full_table_name
127
127
  FROM deadrow_tables
128
- WHERE dead_pct > 0.05
128
+ WHERE dead_pct > 0.12345
129
129
  AND table_bytes > 12345
130
130
  ORDER BY dead_pct DESC, table_bytes DESC;
131
131
  }).and_return(result)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postmodern
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Saxby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-17 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg