table_raw_reader – reading the table proto from disk and examining everything

Ever wondered exactly *what* was in a Drizzle Table proto? Well, wonder no more. A while back this little utility called table_raw_reader hit the drizzle codebase. It’s a simple command line utility that takes a .proto file as an argument, reads it off disk and then prints out a text representation using the TextFormat class of the protobuf library.

An example:

stewart@willster:~/drizzle/jay-and-stewart-remove-pack_flag$ ./drizzled/message/table_raw_reader ./tests/var/master-data/test/t1.dfe
name: "t1"
engine {
  name: "InnoDB"
}
field {
  name: "id"
  type: INTEGER
  format: DefaultFormat
  options {
    length: 11
  }
}
field {
  name: "padding"
  type: VARCHAR
  format: DefaultFormat
  options {
    length: 800
  }
  string_options {
    length: 200
    collation_id: 45
    collation: "utf8_general_ci"
  }
}
indexes {
  name: "PRIMARY"
  is_primary: true
  is_unique: true
  type: UNKNOWN_INDEX
  key_length: 4
  index_part {
    fieldnr: 0
    compare_length: 4
    key_type: 8
  }
  options {
  }
}
type: STANDARD
options {
  collation: "utf8_general_ci"
  collation_id: 45
  pack_record: true
  row_type: ROW_TYPE_DEFAULT
}

This can help a lot when debugging, it already has helped me a lot. It’s left as an exercise for the reader to create a utility that lets you modify the table proto in this text based format.

4 thoughts on “table_raw_reader – reading the table proto from disk and examining everything

  1. Pingback: Drizzle source tarball 1178 has been released « DrizzleBlog

  2. Pingback: Drizzle FRM replacement: the table proto | Ramblings

  3. Can you please add some basic instructions to be able to use the table_raw_reader tool to generate the table for any .proto file? Say, the person.proto (as at protobuf tutorials) . Now, what do I need to do generate t1.dfe like file from person.proto?

  4. that’s not what table_raw_reader does. table_raw_reader just reads the proto for the drizzle table definition and prints it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.