Skip to content

Commit 3034e70

Browse files
committed
- Fix typedef enum declarations to follow PostgreSQL convention
- Run pgindent to standardize code formatting
1 parent 4a442fc commit 3034e70

32 files changed

Lines changed: 357 additions & 296 deletions

.github/workflows/pgindent-check.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ jobs:
2929
3030
- name: Clone and build pg_bsd_indent
3131
run: |
32-
git clone https://git.postgresql.org/git/postgresql.git --depth 1 --branch master /tmp/postgresql
32+
git clone https://git.postgresql.org/git/postgresql.git --depth 1 --branch REL_17_STABLE /tmp/postgresql
3333
cd /tmp/postgresql
3434
./configure --prefix=/tmp/pg-build > /dev/null
3535
cd src/tools/pg_bsd_indent
3636
make > /dev/null
37-
echo "$GITHUB_WORKSPACE/pg-install/bin" >> $GITHUB_PATH
38-
echo "/tmp/postgresql/src/tools/pgindent" >> $GITHUB_PATH
39-
echo "/tmp/postgresql/src/tools/pg_bsd_indent" >> $GITHUB_PATH
37+
echo "/tmp/postgresql/src/tools/pgindent" >> "$GITHUB_PATH"
38+
echo "/tmp/postgresql/src/tools/pg_bsd_indent" >> "$GITHUB_PATH"
4039
4140
- name: Run pgindent and check formatting
4241
working-directory: utils/pgindent
@@ -47,7 +46,7 @@ jobs:
4746
- name: Check for formatting changes
4847
run: |
4948
if ! git diff --quiet; then
50-
echo "::error::Code formatting issues detected. Please run gen-typedefs.sh locally."
49+
echo "::error::Code formatting issues detected. Please run utils/pgindent/run-pgindent.sh locally."
5150
git diff
5251
exit 1
5352
fi

include/spock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extern int restart_delay_default;
5252
extern int restart_delay_on_exception;
5353
extern int spock_replay_queue_size; /* Deprecated - no longer used */
5454
extern bool check_all_uc_indexes;
55-
extern bool spock_enable_quiet_mode;
55+
extern bool spock_enable_quiet_mode;
5656

5757
extern char *shorten_hash(const char *str, int maxlen);
5858
extern void gen_slot_name(Name slot_name, char *dbname,

include/spock_conflict.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ typedef enum SpockConflictResolution
3030
SpockResolution_Skip
3131
} SpockConflictResolution;
3232

33-
typedef enum
33+
typedef enum SpockResolveOption
3434
{
3535
SPOCK_RESOLVE_ERROR,
3636
SPOCK_RESOLVE_APPLY_REMOTE,
@@ -48,7 +48,7 @@ extern bool spock_save_resolutions;
4848
* so use same ordering and similar naming.
4949
* We add one additional conflict type, CT_DELETE_LATE.
5050
*/
51-
typedef enum
51+
typedef enum SpockConflictType
5252
{
5353
/* The row to be inserted violates unique constraint */
5454
SPOCK_CT_INSERT_EXISTS,
@@ -69,17 +69,13 @@ typedef enum
6969
SPOCK_CT_DELETE_MISSING,
7070

7171
/*
72-
* Unique to Spock, delete timestamp is earlier than an existing row.
73-
* Use a higher number so we don't conflict with PostgreSQL in the future.
72+
* Unique to Spock, delete timestamp is earlier than an existing row. Use
73+
* a higher number so we don't conflict with PostgreSQL in the future.
7474
*/
7575
SPOCK_CT_DELETE_LATE = 101
7676

7777
} SpockConflictType;
7878

79-
extern int spock_conflict_resolver;
80-
extern int spock_conflict_log_level;
81-
extern bool spock_save_resolutions;
82-
8379
extern bool get_tuple_origin(SpockRelation *rel, HeapTuple local_tuple,
8480
ItemPointer tid, TransactionId *xmin,
8581
RepOriginId *local_origin, TimestampTz *local_ts);
@@ -122,4 +118,4 @@ extern bool spock_conflict_resolver_check_hook(int *newval, void **extra,
122118
extern void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc,
123119
HeapTuple tuple);
124120

125-
#endif /* SPOCK_CONFLICT_H */
121+
#endif /* SPOCK_CONFLICT_H */

include/spock_group.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ typedef struct SpockGroupKey
6666
/*
6767
* Columns for the UI routine get_apply_group_progress.
6868
*/
69-
typedef enum
69+
typedef enum GroupProgressTupDescColumns
7070
{
7171
GP_DBOID = 0,
7272
GP_NODE_ID,
@@ -115,35 +115,35 @@ typedef enum
115115
*/
116116
typedef struct SpockApplyProgress
117117
{
118-
SpockGroupKey key; /* MUST be first field */
118+
SpockGroupKey key; /* MUST be first field */
119119

120-
TimestampTz remote_commit_ts; /* committed remote txn ts */
120+
TimestampTz remote_commit_ts; /* committed remote txn ts */
121121

122122
/*
123123
* Bit of duplication of remote_commit_ts. Serves the same purpose, except
124124
* keep the last updated value
125125
*/
126-
TimestampTz prev_remote_ts;
127-
XLogRecPtr remote_commit_lsn; /* LSN of remote commit on origin */
128-
XLogRecPtr remote_insert_lsn; /* origin insert/end LSN reported */
126+
TimestampTz prev_remote_ts;
127+
XLogRecPtr remote_commit_lsn; /* LSN of remote commit on origin */
128+
XLogRecPtr remote_insert_lsn; /* origin insert/end LSN reported */
129129

130130
/*
131131
* The largest received LSN by the group. It is more or equal to the
132132
* remote_commit_lsn.
133133
*/
134-
XLogRecPtr received_lsn;
134+
XLogRecPtr received_lsn;
135135

136-
TimestampTz last_updated_ts; /* when we set this */
137-
bool updated_by_decode; /* set by decode or apply. OBSOLETE. Used
136+
TimestampTz last_updated_ts; /* when we set this */
137+
bool updated_by_decode; /* set by decode or apply. OBSOLETE. Used
138138
* in versions <=5.x.x only */
139139
} SpockApplyProgress;
140140

141141
/* Hash entry: one per group (stable pointer; not moved by dynahash) */
142142
typedef struct SpockGroupEntry
143143
{
144-
SpockApplyProgress progress;
145-
pg_atomic_uint32 nattached;
146-
ConditionVariable prev_processed_cv;
144+
SpockApplyProgress progress;
145+
pg_atomic_uint32 nattached;
146+
ConditionVariable prev_processed_cv;
147147
} SpockGroupEntry;
148148

149149
/* shmem setup */

include/spock_jsonb_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ typedef enum /* type categories for datum_to_jsonb */
2020
JSONBTYPE_COMPOSITE, /* composite */
2121
JSONBTYPE_JSONCAST, /* something with an explicit cast to JSON */
2222
JSONBTYPE_OTHER /* all else */
23-
} JsonbTypeCategory;
23+
} JsonbTypeCategory;
2424

2525
typedef struct JsonbInState
2626
{

include/spock_output_plugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ extern bool spock_replication_repair_mode;
100100
#define SPOCK_SYNC_EVENT_MSG 3 /* Sync event message */
101101
#define SPOCK_SLOT_GROUPS_TRANCHE_NAME "spock_slot_groups"
102102

103-
extern int spock_output_delay;
103+
extern int spock_output_delay;
104104

105105
/*
106106
* Custom WAL messages

include/spock_proto_native.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,3 @@ extern void spock_apply_set_proto_version(uint32 version);
8080
extern uint32 spock_apply_get_proto_version(void);
8181

8282
#endif /* SPOCK_PROTO_NATIVE_H */
83-

include/spock_relcache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extern void spock_relation_cache_reset(void);
6969

7070
extern Oid spock_lookup_delta_function(char *fname, Oid typeoid);
7171

72-
extern Oid get_replication_identity(Relation rel);
72+
extern Oid get_replication_identity(Relation rel);
7373

7474
struct SpockTupleData;
7575

include/spock_worker.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "spock_output_plugin.h" /* for SpockOutputSlotGroup */
2020
#include "spock_proto_native.h"
2121

22-
typedef enum
22+
typedef enum SpockWorkerType
2323
{
2424
SPOCK_WORKER_NONE, /* Unused slot. */
2525
SPOCK_WORKER_MANAGER, /* Manager. */
@@ -28,7 +28,7 @@ typedef enum
2828
* table. */
2929
} SpockWorkerType;
3030

31-
typedef enum
31+
typedef enum SpockWorkerStatus
3232
{
3333
SPOCK_WORKER_STATUS_NONE, /* Unused slot. */
3434
SPOCK_WORKER_STATUS_IDLE, /* Idle. */

src/compat/18/spock_compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ check_simple_rowfilter_expr_walker(Node *node, ParseState *pstate)
129129
pstate);
130130
}
131131

132-
/*
132+
/*
133133
* Check if the row filter expression is a "simple expression".
134134
*
135135
* See check_simple_rowfilter_expr_walker for details.

0 commit comments

Comments
 (0)