Class: Maatkit::ChecksumFilter

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeChecksumFilter

Returns a new ChecksumFilter Object



65
66
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 65

def initialize()
end

Instance Attribute Details

#equal_databasesObject

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

#headerObject

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

#helpObject

Show help and exit.



29
30
31
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 29

def help
  @help
end

#ignore_databasesObject

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

#masterObject

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_filterObject

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

#uniqueObject

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

#verboseObject

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

#versionObject

Show version and exit.



55
56
57
# File 'lib/maatkit-ruby/mk-checksum-filter.rb', line 55

def version
  @version
end

Instance Method Details

#configObject



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(options = nil)
  tmp = Tempfile.new('tmp')
  command = option_string() + options.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