Class: Maatkit::ChecksumFilter
- Inherits:
-
Object
- Object
- Maatkit::ChecksumFilter
- Defined in:
- lib/maatkit-ruby/mk-checksum-filter.rb
Overview
Filter checksums from mk-table-checksum.
Maatkit::ChecksumFilter.new( array, str, array)
Instance Attribute Summary collapse
-
#equal_databases ⇒ Object
type: Hash This comma-separated list of databases are equal.
-
#header ⇒ Object
short form: -h Preserves headers output by mk-table-checksum.
-
#help ⇒ Object
Show help and exit.
-
#ignore_databases ⇒ Object
Ignore the database name when comparing lines.
-
#master ⇒ Object
type: string The name of the master server.
-
#path_to_mk_checksum_filter ⇒ Object
Sets the executable path, otherwise the environment path will be used.
-
#unique ⇒ Object
type: string Show unique differing host/db/table names.
-
#verbose ⇒ Object
short form: -v Output all lines, even those that have no differences, except for header lines.
-
#version ⇒ Object
Show version and exit.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize ⇒ ChecksumFilter
constructor
Returns a new ChecksumFilter Object.
-
#start(options = nil) ⇒ Object
Execute the command.
Constructor Details
#initialize ⇒ ChecksumFilter
Returns a new ChecksumFilter Object
65 66 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 65 def initialize() end |
Instance Attribute Details
#equal_databases ⇒ Object
type: Hash This comma-separated list of databases are equal. These database names are always considered to have the same tables. In other words, this makes database1.table1.chunk1 equal to database2.table1.chunk1 if they have the same checksum. This disables incremental processing, so you won’t see any results until all input is processed.
20 21 22 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 20 def equal_databases @equal_databases end |
#header ⇒ Object
short form: -h Preserves headers output by mk-table-checksum.
25 26 27 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 25 def header @header end |
#help ⇒ Object
Show help and exit.
29 30 31 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 29 def help @help end |
#ignore_databases ⇒ Object
Ignore the database name when comparing lines. This disables incremental processing, so you won’t see any results until all input is processed.
34 35 36 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 34 def ignore_databases @ignore_databases end |
#master ⇒ Object
type: string The name of the master server. Specifies which host is the replication master, and sorts lines for that host first, so you can see the checksum values on the master server before the slave.
40 41 42 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 40 def master @master end |
#path_to_mk_checksum_filter ⇒ Object
Sets the executable path, otherwise the environment path will be used.
60 61 62 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 60 def path_to_mk_checksum_filter @path_to_mk_checksum_filter end |
#unique ⇒ Object
type: string Show unique differing host/db/table names. The argument must be one of host, db, or table.
46 47 48 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 46 def unique @unique end |
#verbose ⇒ Object
short form: -v Output all lines, even those that have no differences, except for header lines.
51 52 53 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 51 def verbose @verbose end |
#version ⇒ Object
Show version and exit.
55 56 57 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 55 def version @version end |
Instance Method Details
#config ⇒ Object
91 92 93 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 91 def config option_string() end |
#start(options = nil) ⇒ Object
Execute the command
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 71 def start( = nil) tmp = Tempfile.new('tmp') command = option_string() + .to_s + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |