-
Notifications
You must be signed in to change notification settings - Fork 28
Guidelines to make merging easier
Greenplum is a fork of PostgreSQL. To make it easier to keep it in sync with PostgreSQL, there are some things to do and some things to avoid.
It's highly useful to have PostgreSQL as a remote in your Greenplum repository:
git remote add pgsql git://git.postgresql.org/git/postgresql.git
git fetch pgsql
You can then easily do diffs between the upstream:
git diff REL8_2_0 <filename>
Keep the "diff footprint" of Greenplum as small as possible. Avoid making cosmetic changes to code that was inherited from upstream.
For example, if you need to add an argument to a function, consider adding a new function with the extra argument instead, and leaving the old function in place as a stub, to avoid changing all the callers:
int postgresFunction(int x)
+ {
return postgresFunctionWithExtraArg(x, 0);
+ }
+ int postgresFunctionWithExtraArg(int x, int extra)
+ {
/* do stuff */
+ /* do stuff with the extra arg */
}
Whenever you change code, think what might happen if that or some other piece of code is changed upstream. Make sure that you don't create the situation where an upstream change might apply and compile cleanly, but behave incorrectly at runtime. For example:
- void cleanup(bool alsoFreeMemory)
+ void cleanup(int numberOfChildren)
Even if you find all the callers of cleanup() and change the argument, this is very hazardous when merging with upstream. An upstream patch might introduce a new caller, like "cleanup(true)", which would compile without errors, but 'true' now mean "1 child", which is surely wrong.
If you have to change the meaning of a function, change the name of the function so that any breakage is obvious and happens at compile time, rather than runtime.