bdr: Add .gitattribute to enforce a minimum of whitespace consistency.
authorAndres Freund <andres@anarazel.de>
Sat, 17 Jan 2015 16:45:00 +0000 (17:45 +0100)
committerCraig Ringer <craig@2ndquadrant.com>
Wed, 4 Feb 2015 12:24:28 +0000 (23:24 +1100)
Also fix some existing damage shown by git log/diff --check

16 files changed:
.gitattributes [new file with mode: 0644]
Makefile.in
README.developers
bdr.c
bdr.conf.sample
bdr_init_copy.c
bdr_init_replica.c
bdr_locks.c
bdr_output.c
bdr_pgbench_check.sh
bdr_replication_identifier.h
bdr_seq.c
expected/ddl/function.out
specs/isolation/alter_table.spec
sql/ddl/function.sql
sql/ddl/mixed.sql

diff --git a/.gitattributes b/.gitattributes
new file mode 100644 (file)
index 0000000..89006ca
--- /dev/null
@@ -0,0 +1,10 @@
+*      whitespace=space-before-tab,trailing-space
+*.[chly]   whitespace=space-before-tab,trailing-space,indent-with-non-tab,tabwidth=4
+*.sgml     whitespace=space-before-tab,trailing-space,tab-in-indent,-blank-at-eol
+
+# Test output files that contain extra whitespace
+*.out                  -whitespace
+
+
+# These files are maintained or generated elsewhere.  We take them as is.
+configure              -whitespace
index 7713f45c74717545227239f31d7501c89b7c502f..eaf84c55992bdaec97b6b504c5b179999defe1fc 100644 (file)
@@ -236,7 +236,7 @@ git-dist: clean
    git name-rev --tags --name-only `cat .distgitrev` > .distgittag
    git ls-tree -r -t --full-tree HEAD --name-only |\
      tar cjf "${distdir}.tar.bz2" --transform="s|^|${distdir}/|" -T - \
-       .distgitrev .distgittag 
+       .distgitrev .distgittag
    echo >&2 "Prepared ${distdir}.tar.bz2 for rev=`cat .distgitrev`, tag=`cat .distgittag`"
    rm -f .distgitrev .distgittag
 
index 29b1a48812822208132b06aabafc2df2a40c25aa..36d537d31d2d468f9271cee82f528abb1e24072e 100644 (file)
@@ -22,7 +22,7 @@ Before tagging a release:
 
 * "git log -- bdr--[ver].sql" to see if there were any changes since it
   was created. If there are, you MUST bump the version in bdr.control to
-  the current release version. 
+  the current release version.
 
 * For non-point releases (e.g. 0.6 to 0.7), increase the version in
   bdr.control even if nothing changed in the bdr extension script.
@@ -32,7 +32,7 @@ Before tagging a release:
   extension version 0.7.1 with code version 0.7.2 .
 
 * If bdr.control's version was changed since the last release, as shown by
-  "git diff bdr/prevver bdr-next -- bdr.control" ensure that a 
+  "git diff bdr/prevver bdr-next -- bdr.control" ensure that a
   "bdr--[oldver]--[ver].sql" script exists and is listed in the Makefile's
   DATA section. Make sure it actually produces the expected results.
 
@@ -62,7 +62,7 @@ repo)
 
 At a version bump a control file upgrade script must be created, e.g
 bdr--0.6--0.7.sql. This needs to be *tested* whenever the main control file is
-modified. It needs to be listed in bdr.control . 
+modified. It needs to be listed in bdr.control .
 
 Dist tarballs
 -------------
diff --git a/bdr.c b/bdr.c
index 2e7108f4a971fb633c342ab6dc2a171a4550b414..a05b5ea4571712e1a418c3b3c2557ca3a328b37e 100644 (file)
--- a/bdr.c
+++ b/bdr.c
@@ -449,7 +449,7 @@ bdr_worker_init(char *dbname)
  * Raises an error on failure, will not return null.
  *
  * Arguments:
- *       connection_name:  bdr conn name from bdr.connections to get dsn from
+ *   connection_name:  bdr conn name from bdr.connections to get dsn from
  *
  * Returns:
  *    the libpq connection
@@ -631,7 +631,7 @@ bdr_create_con_gucs(char  *name,
    sprintf(optname_replication_sets, "bdr.%s_replication_sets", name);
    DefineCustomStringVariable(optname_replication_sets,
                               optname_replication_sets,
-                              NULL,
+                              NULL,
                               &opts->replication_sets,
                               NULL, PGC_POSTMASTER,
                               GUC_LIST_INPUT | GUC_LIST_QUOTE,
index 7df52ddfbb2c92fefb19112d59ad49a0e1b856b7..ad34d350b6cb378d916fe0414200f9f0cd8d5021 100644 (file)
@@ -24,7 +24,7 @@ max_replication_slots = 8
 
 # Generally you want to set max_wal_senders to the same value plus a few for
 # pg_basebackup runs, streaming replicas, etc.
-# 
+#
 # This is a suitable setting for a small installation.
 max_wal_senders = 10
 
@@ -52,6 +52,6 @@ bdr.connections = ''
 # bdr.node2_init_replica=on
 # # and apply it to the local db using this dsn
 # bdr.node2_replica_local_dsn="dbname=mydb user=postgres"
-# 
+#
 # bdr.node3_dsn = "host=node3 dbname=mydb"
 #
index cc69c3b1601eebf8ed5a9bd749aaa3051e63fc2f..134d98010fe53b47ca4de3efa1099187f07fddfb 100644 (file)
@@ -620,7 +620,7 @@ initialize_replication_slots(bool init_replica)
        tlid = cfg->init_replica ? ri->tlid + 1 : ri->tlid;
 
        snprintf(system_identifier_s, sizeof(system_identifier_s), UINT64_FORMAT, system_identifier);
-       snprintf(NameStr(slot_name), NAMEDATALEN, BDR_SLOT_NAME_FORMAT,
+       snprintf(NameStr(slot_name), NAMEDATALEN, BDR_SLOT_NAME_FORMAT,
                 ri->dboid, system_identifier_s, tlid,
                 dboid, "");
        NameStr(slot_name)[NAMEDATALEN - 1] = '\0';
index 6ef97f032824c4ccc525e952c2cae0d7407d47e5..d3443fdc20f42753886564de3efe4e686aeb85d6 100644 (file)
@@ -78,7 +78,7 @@ find_init_replica_worker(Name dbname)
    /* Check whether one of our connections has init_replica set */
    for (off = 0; off < bdr_max_workers; off++)
    {
-       BdrApplyWorker         *aw;
+       BdrApplyWorker         *aw;
        BdrConnectionConfig    *cfg;
 
        if (BdrWorkerCtl->slots[off].worker_type != BDR_WORKER_APPLY)
@@ -105,10 +105,10 @@ find_init_replica_worker(Name dbname)
 static char
 bdr_get_remote_status(PGconn *pgconn)
 {
-   PGresult           *res;
-   char                status;
-   Oid                 param_types[] = {TEXTOID, OIDOID, OIDOID};
-   const char         *param_values[3];
+   PGresult           *res;
+   char                status;
+   Oid                 param_types[] = {TEXTOID, OIDOID, OIDOID};
+   const char         *param_values[3];
    /* Needs to fit max length of UINT64_FORMAT */
    char                sysid_str[33];
    char                tlid_str[33];
@@ -169,11 +169,11 @@ static char
 bdr_set_remote_status(PGconn *pgconn, const char status,
                      const char prev_status)
 {
-   PGresult           *res;
+   PGresult           *res;
    char               *status_str;
    const uint64        sysid = GetSystemIdentifier();
    /* Needs to fit max length of UINT64_FORMAT */
-   char                sysid_str[33];
+   char                sysid_str[33];
    char                tlid_str[33];
    char                mydatabaseid_str[33];
 
@@ -197,7 +197,7 @@ bdr_set_remote_status(PGconn *pgconn, const char status,
    {
        Oid         param_types[] = {TEXTOID, OIDOID, OIDOID};
        const char *param_values[3];
-       char        new_status;
+       char        new_status;
 
        param_values[0] = sysid_str;
        param_values[1] = tlid_str;
@@ -370,7 +370,7 @@ bdr_ensure_ext_installed(PGconn *pgconn, Name bdr_conn_name)
                     NameStr(*bdr_conn_name)),
                     errdetail("no entry with name 'bdr' in pg_extensions"),
                     errhint("add 'bdr' to shared_preload_libraries in postgresql.conf "
-                            "on the target server and restart it.")));
+                            "on the target server and restart it.")));
        }
    }
    else if (PQntuples(res) == 0)
@@ -515,8 +515,8 @@ bdr_exec_init_replica(BdrConnectionConfig *cfg, char *snapshot)
    get_parent_directory(bindir);
 
    if (find_other_exec(my_exec_path, BDR_INIT_REPLICA_CMD,
-                       BDR_INIT_REPLICA_CMD " (PostgreSQL " PG_VERSION ", BDR " BDR_VERSION ")\n",
-                       &bdr_init_replica_script_path[0]) < 0)
+                       BDR_INIT_REPLICA_CMD " (PostgreSQL " PG_VERSION ", BDR " BDR_VERSION ")\n",
+                       &bdr_init_replica_script_path[0]) < 0)
    {
        elog(ERROR, "bdr: failed to find " BDR_INIT_REPLICA_CMD
             " relative to binary %s or wrong version. Expected (PostgreSQL %s, BDR %s)",
@@ -524,8 +524,8 @@ bdr_exec_init_replica(BdrConnectionConfig *cfg, char *snapshot)
    }
 
    if (find_other_exec(my_exec_path, BDR_DUMP_CMD,
-                       "pg_dump (PostgreSQL) " PG_VERSION "\n",
-                       &bdr_dump_path[0]) < 0)
+                       "pg_dump (PostgreSQL) " PG_VERSION "\n",
+                       &bdr_dump_path[0]) < 0)
    {
        elog(ERROR, "bdr: failed to find " BDR_DUMP_CMD
             " relative to binary %s or wrong version (expected %s)",
@@ -533,8 +533,8 @@ bdr_exec_init_replica(BdrConnectionConfig *cfg, char *snapshot)
    }
 
    if (find_other_exec(my_exec_path, BDR_RESTORE_CMD,
-                       BDR_RESTORE_CMD " (PostgreSQL) " PG_VERSION "\n",
-                       &bdr_restore_path[0]) < 0)
+                       BDR_RESTORE_CMD " (PostgreSQL) " PG_VERSION "\n",
+                       &bdr_restore_path[0]) < 0)
    {
        elog(ERROR, "bdr: failed to find " BDR_RESTORE_CMD
             " relative to binary %s or wrong version (expected %s)",
@@ -922,7 +922,7 @@ bdr_init_replica(Name dbname)
            LWLockAcquire(BdrWorkerCtl->lock, LW_SHARED);
            for (off = 0; off < bdr_max_workers; off++)
            {
-               BdrWorker              *worker = &BdrWorkerCtl->slots[off];
+               BdrWorker              *worker = &BdrWorkerCtl->slots[off];
 
                if (worker->worker_type == BDR_WORKER_APPLY)
                {
index 629542ff49b5b58c67d2d04265f28eb41ceca816..933afb08f46af1b831bdbe0064df70ac3f495105 100644 (file)
@@ -899,7 +899,7 @@ bdr_process_release_ddl_lock(uint64 origin_sysid, TimeLineID origin_tli, Oid ori
                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
                 errmsg("Did not find local DDL lock entry for a remotely released global DDL lock"),
                 errdetail("node ("BDR_LOCALID_FORMAT") sent a release message but the lock isn't held locally",
-                          lock_sysid, lock_tli, lock_datid, "")));
+                          lock_sysid, lock_tli, lock_datid, "")));
 
    LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
    if (bdr_my_locks_database->lockcount > 0)
index e2baedaaa8eb30f7d3b0223d7027dfeb9aa80191..90606c0f1ad3dc3a5dd3cbf4f8aebadf4be2caf3 100644 (file)
@@ -491,7 +491,7 @@ pg_decode_startup(LogicalDecodingContext * ctx, OutputPluginOptions *opt, bool i
    if (get_namespace_oid("bdr", true) == InvalidOid)
    {
        ereport(ERROR,
-               (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+               (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
                 errmsg("bdr extension does not exist on " BDR_LOCALID_FORMAT,
                        BDR_LOCALID_FORMAT_ARGS),
                 errdetail("Cannot create a BDR slot without the BDR extension installed")));
index 1f7e97feac3a880a1f4a4447c455e9a78acf6031..afacab999a5c165ba969c5666369a8edcf30e0fe 100644 (file)
@@ -173,4 +173,3 @@ if [ ! -n "$?" ]; then
    echo "ERROR: data in databases differ, check $DATADIR/chksum.diff"
    exit 1
 fi
-
index b41fcc3b3feaa07f862b094ceafdcf9f5c745775..8264d61318db815133dd65ac436a73bc941209a4 100644 (file)
@@ -53,8 +53,8 @@ extern Datum bdr_replication_identifier_drop(PG_FUNCTION_ARGS);
  * Used by GetReplicationInfoByIdentifier()
  */
 typedef struct {
-        Oid        riident;
-        text   riname;
+   Oid     riident;
+   text    riname;
 } FormData_pg_replication_identifier;
 typedef FormData_pg_replication_identifier *Form_pg_replication_identifier;
 
index 1ded27f38abe5e9f886cf1882c501ac10365b1c3..bd7ee4f7a7f685d0123800cea3850e6246cc50e3 100644 (file)
--- a/bdr_seq.c
+++ b/bdr_seq.c
@@ -1048,10 +1048,10 @@ bdr_sequence_alloc(PG_FUNCTION_ARGS)
        ereport(ERROR,
                (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
                 errmsg("global sequence %s.%s is not initialized yet",
-                       get_namespace_name(RelationGetNamespace(seqrel)),
+                       get_namespace_name(RelationGetNamespace(seqrel)),
                        RelationGetRelationName(seqrel)),
                 errhint("All nodes must agree before the sequence is usable. "
-                        "Try again soon. Check all nodes are up if the condition "
+                        "Try again soon. Check all nodes are up if the condition "
                         "persists.")));
 
    curval = (BdrSequenceValues *) VARDATA_ANY(DatumGetByteaP(values));
@@ -1125,10 +1125,10 @@ bdr_sequence_alloc(PG_FUNCTION_ARGS)
        ereport(ERROR,
                (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
                 errmsg("could not find free sequence value for global sequence %s.%s",
-                       get_namespace_name(RelationGetNamespace(seqrel)),
+                       get_namespace_name(RelationGetNamespace(seqrel)),
                        RelationGetRelationName(seqrel)),
                 errhint("The sequence is refilling from remote nodes. Try again soon. "
-                        "Check that all nodes are up if the condition persists.")));
+                        "Check that all nodes are up if the condition persists.")));
    }
 
    if (wakeup)
index d50c1c1d5c8e2082d8d3f9d61c4185b8bd5cafab..389587554d9443b814d0709b9dc682922abacf41 100644 (file)
@@ -4,7 +4,6 @@ CREATE FUNCTION test_fn(IN inpar character varying (20), INOUT inoutpar integer,
 $$
 BEGIN
    PERFORM E'\t\r\n\b\f';
-   \r
 END;
 $$ LANGUAGE plpgsql IMMUTABLE  STRICT;
 \df+ test_fn
@@ -14,7 +13,6 @@ $$ LANGUAGE plpgsql IMMUTABLE  STRICT;
  public | test_fn | SETOF record     | inpar character varying, INOUT inoutpar integer, OUT timestamp with time zone | normal | invoker  | immutable  | super | plpgsql  |                               +| 
         |         |                  |                                                                               |        |          |            |       |          | BEGIN                         +| 
         |         |                  |                                                                               |        |          |            |       |          |         PERFORM E'\t\r\n\b\f';+| 
-        |         |                  |                                                                               |        |          |            |       |          |         \r                    +| 
         |         |                  |                                                                               |        |          |            |       |          | END;                          +| 
         |         |                  |                                                                               |        |          |            |       |          |                                | 
 (1 row)
@@ -27,7 +25,6 @@ $$ LANGUAGE plpgsql IMMUTABLE  STRICT;
  public | test_fn | SETOF record     | inpar character varying, INOUT inoutpar integer, OUT timestamp with time zone | normal | invoker  | immutable  | super | plpgsql  |                               +| 
         |         |                  |                                                                               |        |          |            |       |          | BEGIN                         +| 
         |         |                  |                                                                               |        |          |            |       |          |         PERFORM E'\t\r\n\b\f';+| 
-        |         |                  |                                                                               |        |          |            |       |          |         \r                    +| 
         |         |                  |                                                                               |        |          |            |       |          | END;                          +| 
         |         |                  |                                                                               |        |          |            |       |          |                                | 
 (1 row)
@@ -40,7 +37,6 @@ ALTER FUNCTION test_fn(varchar, integer) SECURITY DEFINER CALLED ON NULL INPUT V
  public | test_fn | SETOF record     | inpar character varying, INOUT inoutpar integer, OUT timestamp with time zone | normal | definer  | volatile   | super | plpgsql  |                               +| 
         |         |                  |                                                                               |        |          |            |       |          | BEGIN                         +| 
         |         |                  |                                                                               |        |          |            |       |          |         PERFORM E'\t\r\n\b\f';+| 
-        |         |                  |                                                                               |        |          |            |       |          |         \r                    +| 
         |         |                  |                                                                               |        |          |            |       |          | END;                          +| 
         |         |                  |                                                                               |        |          |            |       |          |                                | 
 (1 row)
@@ -53,7 +49,6 @@ ALTER FUNCTION test_fn(varchar, integer) SECURITY DEFINER CALLED ON NULL INPUT V
  public | test_fn | SETOF record     | inpar character varying, INOUT inoutpar integer, OUT timestamp with time zone | normal | definer  | volatile   | super | plpgsql  |                               +| 
         |         |                  |                                                                               |        |          |            |       |          | BEGIN                         +| 
         |         |                  |                                                                               |        |          |            |       |          |         PERFORM E'\t\r\n\b\f';+| 
-        |         |                  |                                                                               |        |          |            |       |          |         \r                    +| 
         |         |                  |                                                                               |        |          |            |       |          | END;                          +| 
         |         |                  |                                                                               |        |          |            |       |          |                                | 
 (1 row)
index a740f9c8416920b574dbc1adb9517474552058c0..1291a31c7cc9173a8f7db38170675be87427f59f 100644 (file)
@@ -37,4 +37,3 @@ step "n2s1" { UPDATE tst SET c = 'changed' WHERE a = 1; }
 step "n2s2" { UPDATE tst SET b = 'changed' WHERE a = 1; }
 
 permutation "n1s1" "n1sync" "n2read" "n1s2" "n1sync" "n2read" "n1s3" "n1s4" "n1sync" "n2read" "n1s5" "n1s6" "n1sync" "n2read" "n1s7" "n1sync" "n2read" "n1s8" "n1s9" "n1s10" "n2s1" "n2sync" "n1s11" "n1sync" "n2sync" "n2read" "n1read" "n2s2" "n2sync" "n1read"
-
index 5f749a605b5c70399655c2ab63f924aa5fe8ed1e..fe0e9ca4ad93f25f8a2e2d9aee8bdd20cf638def 100644 (file)
@@ -4,7 +4,6 @@ CREATE FUNCTION test_fn(IN inpar character varying (20), INOUT inoutpar integer,
 $$
 BEGIN
    PERFORM E'\t\r\n\b\f';
-   \r
 END;
 $$ LANGUAGE plpgsql IMMUTABLE  STRICT;
 \df+ test_fn
index 0a8a9dac6665eaa8e8cbc5a01d54eb850500f7d0..bfa3f3052e864fbbca5c7c846dbfd9f71faa859c 100644 (file)
@@ -18,4 +18,3 @@ UPDATE add_column SET other = 'foobar';
 SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
 \c regression
 SELECT id, data, other FROM add_column ORDER BY id;
-