Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/pgindent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: pgindent formatting check
run-name: Check pgindent formatting

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

jobs:
pgindent-check:
runs-on: ubuntu-latest

steps:
- name: Checkout spock
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Set up Docker
# Codacy wants us to use full commit SHA. This is for v3
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3

- name: Build docker image (PG 18)
run: |
docker build \
--build-arg PGVER=18 \
-t spock-pgindent -f tests/docker/Dockerfile-step-1.el9 .

- name: Run pgindent --check
run: |
docker run --rm spock-pgindent bash -c '
source ~/.bashrc
make -C $PG_SRCDIR/src/tools/pg_bsd_indent > /dev/null
export PATH="$PG_SRCDIR/src/tools/pgindent:$PG_SRCDIR/src/tools/pg_bsd_indent:$PATH"
cd ~/spock/utils/pgindent
./run-pgindent.sh --check
'
2 changes: 1 addition & 1 deletion include/spock.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern int restart_delay_default;
extern int restart_delay_on_exception;
extern int spock_replay_queue_size;
extern bool check_all_uc_indexes;
extern bool spock_enable_quiet_mode;
extern bool spock_enable_quiet_mode;
extern int log_origin_change;
extern int spock_apply_idle_timeout;

Expand Down
22 changes: 11 additions & 11 deletions include/spock_conflict.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ typedef enum SpockConflictResolution
SpockResolution_Skip
} SpockConflictResolution;

typedef enum
typedef enum SpockResolveOption
{
SPOCK_RESOLVE_ERROR,
SPOCK_RESOLVE_APPLY_REMOTE,
Expand Down Expand Up @@ -69,8 +69,8 @@ typedef enum
SPOCK_CT_DELETE_MISSING,

/*
* Unique to Spock, delete timestamp is earlier than an existing row.
* Use a higher number so we don't conflict with PostgreSQL in the future.
* Unique to Spock, delete timestamp is earlier than an existing row. Use
* a higher number so we don't conflict with PostgreSQL in the future.
*/
SPOCK_CT_DELETE_EXISTS = 101

Expand Down Expand Up @@ -106,17 +106,17 @@ typedef enum
SPOCK_ORIGIN_REMOTE_ONLY_DIFFERS,
/* log only if origin changed since start of subscription */
SPOCK_ORIGIN_DIFFERS_SINCE_SUB
} SpockSaveOriginConflictOption;
} SpockSaveOriginConflictOption;


extern bool spock_tuple_find_replidx(ResultRelInfo *relinfo,
SpockTupleData *tuple,
TupleTableSlot *oldslot,
Oid *idxrelid);
SpockTupleData *tuple,
TupleTableSlot *oldslot,
Oid *idxrelid);

extern Oid spock_tuple_find_conflict(ResultRelInfo *relinfo,
SpockTupleData *tuple,
TupleTableSlot *oldslot);
extern Oid spock_tuple_find_conflict(ResultRelInfo *relinfo,
SpockTupleData *tuple,
TupleTableSlot *oldslot);

extern bool get_tuple_origin(SpockRelation *rel, HeapTuple local_tuple,
ItemPointer tid, TransactionId *xmin,
Expand Down Expand Up @@ -162,4 +162,4 @@ extern bool spock_conflict_resolver_check_hook(int *newval, void **extra,
extern void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc,
HeapTuple tuple);

#endif /* SPOCK_CONFLICT_H */
#endif /* SPOCK_CONFLICT_H */
4 changes: 2 additions & 2 deletions include/spock_conflict_stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ extern void spock_stat_create_subscription(Oid subid);
extern void spock_stat_drop_subscription(Oid subid);
extern Spock_Stat_StatSubEntry *spock_stat_fetch_stat_subscription(Oid subid);

#endif /* PG_VERSION_NUM >= 180000 */
#endif /* PG_VERSION_NUM >= 180000 */

#endif /* SPOCK_CONFLICT_STAT_H */
#endif /* SPOCK_CONFLICT_STAT_H */
24 changes: 12 additions & 12 deletions include/spock_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ typedef struct SpockGroupKey
/*
* Columns for the UI routine get_apply_group_progress.
*/
typedef enum
typedef enum GroupProgressTupDescColumns
{
GP_DBOID = 0,
GP_NODE_ID,
Expand Down Expand Up @@ -115,35 +115,35 @@ typedef enum
*/
typedef struct SpockApplyProgress
{
SpockGroupKey key; /* MUST be first field */
SpockGroupKey key; /* MUST be first field */

TimestampTz remote_commit_ts; /* committed remote txn ts */
TimestampTz remote_commit_ts; /* committed remote txn ts */

/*
* Bit of duplication of remote_commit_ts. Serves the same purpose, except
* keep the last updated value
*/
TimestampTz prev_remote_ts;
XLogRecPtr remote_commit_lsn; /* LSN of remote commit on origin */
XLogRecPtr remote_insert_lsn; /* origin insert/end LSN reported */
TimestampTz prev_remote_ts;
XLogRecPtr remote_commit_lsn; /* LSN of remote commit on origin */
XLogRecPtr remote_insert_lsn; /* origin insert/end LSN reported */

/*
* The largest received LSN by the group. It is more or equal to the
* remote_commit_lsn.
*/
XLogRecPtr received_lsn;
XLogRecPtr received_lsn;

TimestampTz last_updated_ts; /* when we set this */
bool updated_by_decode; /* set by decode or apply. OBSOLETE. Used
TimestampTz last_updated_ts; /* when we set this */
bool updated_by_decode; /* set by decode or apply. OBSOLETE. Used
* in versions <=5.x.x only */
} SpockApplyProgress;

/* Hash entry: one per group (stable pointer; not moved by dynahash) */
typedef struct SpockGroupEntry
{
SpockApplyProgress progress;
pg_atomic_uint32 nattached;
ConditionVariable prev_processed_cv;
SpockApplyProgress progress;
pg_atomic_uint32 nattached;
ConditionVariable prev_processed_cv;
} SpockGroupEntry;

/* shmem setup */
Expand Down
2 changes: 1 addition & 1 deletion include/spock_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef struct SpockSubscription
XLogRecPtr skiplsn; /* All changes finished at this LSN are
* skipped */
List *skip_schema; /* Array of schema names to skip */
TimestampTz created_at; /* When this subscription was created */
TimestampTz created_at; /* When this subscription was created */
} SpockSubscription;

/* NULL-terminated arrays */
Expand Down
2 changes: 1 addition & 1 deletion include/spock_output_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ extern bool spock_replication_repair_mode;
#define SPOCK_SYNC_EVENT_MSG 3 /* Sync event message */
#define SPOCK_SLOT_GROUPS_TRANCHE_NAME "spock_slot_groups"

extern int spock_output_delay;
extern int spock_output_delay;

/*
* Custom WAL messages
Expand Down
1 change: 0 additions & 1 deletion include/spock_proto_native.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,3 @@ extern void spock_apply_set_proto_version(uint32 version);
extern uint32 spock_apply_get_proto_version(void);

#endif /* SPOCK_PROTO_NATIVE_H */

2 changes: 1 addition & 1 deletion include/spock_relcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extern void spock_relation_cache_reset(void);

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

extern Oid get_replication_identity(Relation rel);
extern Oid get_replication_identity(Relation rel);

struct SpockTupleData;

Expand Down
8 changes: 4 additions & 4 deletions include/spock_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ typedef struct SpockSyncStatus
/*
* Signal exception behaviour on sync attempt. At this moment it is
* hardcoded to be true for table sync and false for subscription sync.
* Should be introduced into the extension's interface later.
* NOTE: The default value is false. Our current pattern is to create the
* structure and immediately zero it; earlier versions will just follow
* the previous logic and retry in case of an error.
* Should be introduced into the extension's interface later. NOTE: The
* default value is false. Our current pattern is to create the structure
* and immediately zero it; earlier versions will just follow the previous
* logic and retry in case of an error.
*/
bool stop_on_error;

Expand Down
4 changes: 2 additions & 2 deletions include/spock_worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef enum
SPOCK_WORKER_APPLY, /* Apply. */
SPOCK_WORKER_SYNC /* Special type of Apply that synchronizes one
* table. */
} SpockWorkerType;
} SpockWorkerType;

typedef enum
{
Expand All @@ -36,7 +36,7 @@ typedef enum
SPOCK_WORKER_STATUS_STOPPING, /* Stopping. */
SPOCK_WORKER_STATUS_STOPPED, /* Stopped. */
SPOCK_WORKER_STATUS_FAILED, /* Failed. */
} SpockWorkerStatus;
} SpockWorkerStatus;

typedef struct SpockApplyWorker
{
Expand Down
8 changes: 4 additions & 4 deletions src/compat/18/spock_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ check_simple_rowfilter_expr_walker(Node *node, ParseState *pstate)
}

/*
* Check if the row filter expression is a "simple expression".
*
* See check_simple_rowfilter_expr_walker for details.
*/
* Check if the row filter expression is a "simple expression".
*
* See check_simple_rowfilter_expr_walker for details.
*/
bool
check_simple_rowfilter_expr(Node *node, ParseState *pstate)
{
Expand Down
18 changes: 9 additions & 9 deletions src/spock.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static const struct config_enum_entry exception_logging_options[] = {
static const struct config_enum_entry readonly_options[] = {
{"off", READONLY_OFF, false},
{"local", READONLY_LOCAL, false},
{"user", READONLY_LOCAL, true}, /* backward-compatible alias */
{"user", READONLY_LOCAL, true}, /* backward-compatible alias */
{"all", READONLY_ALL, false},
{NULL, 0, false}
};
Expand Down Expand Up @@ -923,7 +923,7 @@ log_message_filter(ErrorData *edata)
static void
spock_object_relabel(const ObjectAddress *object, const char *seclabel)
{
Oid extoid;
Oid extoid;

extoid = get_extension_oid(EXTENSION_NAME, true);
if (!OidIsValid(extoid))
Expand Down Expand Up @@ -1200,13 +1200,13 @@ _PG_init(void)
NULL);

DefineCustomEnumVariable("spock.log_origin_change",
gettext_noop("If set, log when the origin of a tuple changes."),
NULL,
&log_origin_change,
SPOCK_ORIGIN_NONE,
SpockOriginConflicts,
PGC_SUSET, 0,
NULL, NULL, NULL);
gettext_noop("If set, log when the origin of a tuple changes."),
NULL,
&log_origin_change,
SPOCK_ORIGIN_NONE,
SpockOriginConflicts,
PGC_SUSET, 0,
NULL, NULL, NULL);

DefineCustomIntVariable("spock.apply_idle_timeout",
"Maximum idle time in seconds before apply worker reconnects",
Expand Down
Loading
Loading