Giter Club home page Giter Club logo

go-frm-parser's Introduction

go-frm-parser

Parsing MySQL '.frm' file from stream inspired by frmdump of dbsake

Why we write this

We have a MySQL database has lots of tables and we need the consistency table schema of the Xtrabackup result. When streaming to storage, we managed to get the schema info from the physical files(frm for MySQL 5.x, ibd for 8.x) The dbsake only takes frm data from a file, this lib can take it from memory.

How is the compatability

It's goal is totally compatable with dbsake frmdump tablename.frm result.

How is the performance

We tested the performance with MySQL 5.7.38 and the speed is about 30x faster than dbsake version. Example: A database which has 229 tables takes 30s by using dbsake, but 1.29s by using go-frm-parser

How to use it

Just give the parser filepath and file reader of the frm file.

 path := os.Args[1]
 file, err := os.Open(path)
 if err != nil {
  fmt.Println("Error:", err)
  return
 }
 defer file.Close()

 // read and parse frm file
 result, err := frm.Parse(path, file)
 if err != nil {
  fmt.Println("Error:", err)
  return
 }
 fmt.Printf("====WITHOUT HEADER:\n%s", result.String())
 fmt.Printf("\n====WITH HEADER:\n%s", result.StringWithHeader())

go-frm-parser's People

Contributors

zing22845 avatar

Stargazers

joy avatar

Watchers

 avatar

go-frm-parser's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.