Skip to content

Commit

Permalink
Update README and Add CONTRIBUTING (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsyh authored and july2993 committed Apr 26, 2019
1 parent 8d39e26 commit e671adb
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 10 deletions.
91 changes: 91 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# How to contribute

This document outlines some of the conventions on development workflow, commit
message formatting, contact points and other resources to make it easier to get
your contribution accepted.

## Getting started

- Fork the repository on GitHub.
- Read the README.md for build instructions.
- Play with the project, submit bugs, submit patches!

## Building TiDB-Binlog

Developing TiDB-Binlog requires:

* [Go 1.11+](http://golang.org/doc/code.html)
* An internet connection to download the dependencies

Simply run `make` to build the program.

```sh
make
```

### Running tests

This project contains unit tests and integration tests with coverage collection.
See [tests/README.md](./tests/README.md) for how to execute and add tests.


### Updating dependencies

TiDB-Binlog uses [Go 1.11 module](https://github.com/golang/go/wiki/Modules) to manage dependencies.
To add or update a dependency: use the `go mod edit` command to change the dependency.

## Contribution flow

This is a rough outline of what a contributor's workflow looks like:

- Create a topic branch from where you want to base your work. This is usually `master`.
- Make commits of logical units and add test case if the change fixes a bug or adds new functionality.
- Run tests and make sure all the tests are passed.
- Make sure your commit messages are in the proper format (see below).
- Push your changes to a topic branch in your fork of the repository.
- Submit a pull request.
- Your PR must receive LGTMs from two maintainers.

Thanks for your contributions!

### Code style

The coding style suggested by the Golang community is used in TiDB-Binlog.
See the [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for details.

Please follow this style to make TiDB-Binlog easy to review, maintain and develop.

### Format of the Commit Message

We follow a rough convention for commit messages that is designed to answer two
questions: what changed and why. The subject line should feature the what and
the body of the commit should describe the why.

```
Pump: add comment for variable declaration
Improve documentation.
```

The format can be described more formally as follows:

```
<subsystem>: <what changed>
<BLANK LINE>
<why this change was made>
<BLANK LINE>
<footer>(optional)
```

The first line is the subject and should be no longer than 70 characters, the
second line is always blank, and other lines should be wrapped at 80 characters.
This allows the message to be easier to read on GitHub as well as in various
git tools.

If the change affects more than one subsystem, you can use comma to separate them like `pump,drainer:`.

If the change affects many subsystems, you can use ```*``` instead, like ```*:```.

For the why part, if no specific reason for the change,
you can use one of some generic reasons like "Improve documentation.",
"Improve performance.", "Improve robustness.", "Improve test coverage."
49 changes: 39 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,64 @@ TiDB-Binlog is a commercial tool used to collect [TiDB's](https://github.com/pin
Replay from any history point.

## Documentation

+ [Detailed documentation](https://pingcap.com/docs/tools/tidb-binlog-cluster/)
+ [简体中文](https://pingcap.com/docs-cn/tools/tidb-binlog-cluster/)

## Architecture

![architecture](./docs/architecture.png)

## Service list

[Pump](./cmd/pump)

Pump is a daemon that receives real-time binlogs from tidb-server and writes in sequential disk files synchronously.

[Drainer](./cmd/drainer)

Drainer collects binlogs from each Pump in the cluster, transforms binlogs to various dialects of SQL, and applies to the downstream database or filesystem.

## How to build

To check the code style and build binaries, you can simply run:

```
make build # build all components
```

make pump # build pump
If you only want to build binaries, you can run:

make drainer # build drainer
```
make pump # build pump
When TiDB-Binlog is built successfully, you can find the binary in the `bin` directory.

## Service list
make drainer # build drainer
```

[Pump](./cmd/pump)
When TiDB-Binlog is built successfully, you can find the binary in the `bin` directory.

Pump is a daemon that receives real-time binlogs from tidb-server and writes in sequential disk files synchronously.
## Run Test

[Drainer](./cmd/drainer)
Run all tests, including unit test and integration test

Drainer collects binlogs from each Pump in the cluster, transforms binlogs to various dialects of SQL, and applies to the downstream database or filesystem.
```
make test
```
See [tests](./tests/README.md) for how to execute and add integration tests.

## Deployment

The recommended startup sequence: PD -> TiKV -> [Pump](./cmd/pump) -> TiDB -> [Drainer](./cmd/drainer)

The best way to install TiDB-Binlog is via [TiDB-Binlog-Ansible](https://www.pingcap.com/docs-cn/tools/tidb-binlog-cluster/)


## Config File
* Pump config file: [pump.toml](./cmd/pump/pump.toml)
* Drainer config file: [drainer.toml](./cmd/drainer/drainer.toml)

## Contributing
Contributions are welcomed and greatly appreciated. See [CONTRIBUTING.md](./CONTRIBUTING.md)
for details on submitting patches and the contribution workflow.

## License
TiDB-Binlog is under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for details.

0 comments on commit e671adb

Please sign in to comment.