refs #10 - merged gh10 to 3.x

Squashed commit of the following:

commit 84c4983ebba509d4dbbabc1d5abb0f33eac7a937
Author: dirtysalt <dirtysalt1987@gmail.com>
Date:   Mon Jun 9 18:10:01 2014 +0800

    Refs #10: set restored view type to NON_PRIM, this could solve pc remerge problem well

commit 8fd683ee1fb9f5994643b1c9150c9a5d3f148ec1
Author: dirtysalt <dirtysalt1987@gmail.com>
Date:   Mon Jun 9 09:16:42 2014 +0800

    Refs #10: don not clear rst view after sending install message. otherwise if network partition happens when sending install message, restored view is lost

commit 7e5ddba94f97f4d13f5e27bde10a1b17bfe6b319
Author: dirtysalt <dirtysalt1987@gmail.com>
Date:   Sun Jun 8 13:21:29 2014 +0800

    Refs #10: clear rst_view when pc is formed.
    otherwise it may prevents pc remerge. see case https://github.com/codership/galera/issues/47\#issuecomment-45083066

commit 9bcd01fc57ef2ac66c25c1ffa10b2f1dd6900472
Author: dirtysalt <dirtysalt1987@gmail.com>
Date:   Tue Jun 3 17:28:05 2014 +0800

    Refs #10: remove state file on graceful shutdown

commit 53ae454a387d0cbe8d3b10126e755f20aee27fb3
Author: dirtysalt <dirtysalt1987@gmail.com>
Date:   Tue Jun 3 15:05:58 2014 +0800

    Refs #10: fix typo

commit 0afd00e539be4829b51d7d788b09b84a9f25032d
Author: dirtysalt <dirtysalt1987@gmail.com>
Date:   Tue Jun 3 10:30:53 2014 +0800

    Refs #10: remove gvwstate.dat file if pc.recovery=0 to avoid read stale state file.
    This situation could happens in following scenario.
    1. node starts up with pc.recovery=1, and has state file
    2. then node starts up with pc.recovery=0, so right now state file is stale.
    3. then node starts up with pc.recovery=1 again, stale file is used.

commit 6003b0ef602fe31c9f82dc92c518426d033f17b4
Author: dirtysalt <dirtysalt1987@gmail.com>
Date:   Mon Jun 2 07:19:54 2014 +0800

    Refs #10: remove pc.save_prim and make pc.recovery to control write state file or not

commit 30a66da960dec9263b4c65e4a66e0404c6fa7ea3
Author: dirtysalt <dirtysalt1987@gmail.com>
Date:   Sun Jun 1 23:02:56 2014 +0800

    Refs #10: avoid gvwstate.file to interfere with unit tests
    1. move vst.write_file from pc_proto.cpp to pc.cpp
    2. add pc.save_prim to control save prim component or not.