diff options
author | Michael Paquier | 2012-07-12 00:08:29 +0000 |
---|---|---|
committer | Michael Paquier | 2012-07-12 00:08:29 +0000 |
commit | bb7c8a6bb9d7f5cf5f4bc51dc2c13533b84b6547 (patch) | |
tree | fa083eb072283dfa96304b8cca712667f1776e16 | |
parent | ed3516bfc3d6dd540877f2bc4bd71a4990b65763 (diff) |
Remove all the trailing whitespaces in GTM code
-rw-r--r-- | src/gtm/client/fe-connect.c | 2 | ||||
-rw-r--r-- | src/gtm/client/fe-protocol.c | 12 | ||||
-rw-r--r-- | src/gtm/common/gtm_lock.c | 3 | ||||
-rw-r--r-- | src/gtm/common/gtm_opt_handler.c | 4 | ||||
-rw-r--r-- | src/gtm/common/gtm_serialize.c | 8 | ||||
-rw-r--r-- | src/gtm/common/gtm_serialize_debug.c | 4 | ||||
-rw-r--r-- | src/gtm/common/gtm_utils.c | 1 | ||||
-rw-r--r-- | src/gtm/common/mcxt.c | 3 | ||||
-rw-r--r-- | src/gtm/gtm_ctl/gtm_ctl.c | 10 | ||||
-rw-r--r-- | src/gtm/libpq/pqcomm.c | 2 | ||||
-rw-r--r-- | src/gtm/main/gtm_seq.c | 34 | ||||
-rw-r--r-- | src/gtm/main/gtm_snap.c | 6 | ||||
-rw-r--r-- | src/gtm/main/gtm_standby.c | 18 | ||||
-rw-r--r-- | src/gtm/main/gtm_stats.c | 2 | ||||
-rw-r--r-- | src/gtm/main/gtm_thread.c | 1 | ||||
-rw-r--r-- | src/gtm/main/gtm_txn.c | 45 | ||||
-rw-r--r-- | src/gtm/main/main.c | 40 | ||||
-rw-r--r-- | src/gtm/path/path.c | 1 | ||||
-rw-r--r-- | src/gtm/proxy/gtm_proxy_opt.c | 2 | ||||
-rw-r--r-- | src/gtm/proxy/proxy_main.c | 44 | ||||
-rw-r--r-- | src/gtm/proxy/proxy_thread.c | 22 | ||||
-rw-r--r-- | src/gtm/proxy/proxy_utils.c | 2 | ||||
-rw-r--r-- | src/gtm/recovery/register_common.c | 3 | ||||
-rw-r--r-- | src/gtm/recovery/register_gtm.c | 1 |
24 files changed, 130 insertions, 140 deletions
diff --git a/src/gtm/client/fe-connect.c b/src/gtm/client/fe-connect.c index 341c0ed3ac..157baa61b7 100644 --- a/src/gtm/client/fe-connect.c +++ b/src/gtm/client/fe-connect.c @@ -139,7 +139,7 @@ PQconnectGTMStart(const char *conninfo) * connectOptions1 * * Internal subroutine to set up connection parameters given an already- - * created GTM_Conn and a conninfo string. + * created GTM_Conn and a conninfo string. * * Returns true if OK, false if trouble (in which case errorMessage is set * and so is conn->status). diff --git a/src/gtm/client/fe-protocol.c b/src/gtm/client/fe-protocol.c index ab4e3f52e5..06c492fe5d 100644 --- a/src/gtm/client/fe-protocol.c +++ b/src/gtm/client/fe-protocol.c @@ -129,7 +129,7 @@ pqParseInput(GTM_Conn *conn) case 'E': /* error return */ if (gtmpqGetError(conn, result)) return NULL; - result->gr_status = GTM_RESULT_ERROR; + result->gr_status = GTM_RESULT_ERROR; break; default: printfGTMPQExpBuffer(&conn->errorMessage, @@ -517,14 +517,14 @@ gtmpqParseSuccess(GTM_Conn *conn, GTM_Result *result) xsize = result->gr_xip_size; xcnt = result->gr_snapshot.sn_xcnt; xip = result->gr_snapshot.sn_xip; - + if ((xip == NULL) || (xcnt > xsize)) { xip = (GlobalTransactionId *) realloc(xip, sizeof (GlobalTransactionId) * xcnt); result->gr_snapshot.sn_xip = xip; result->gr_xip_size = xcnt; } - + if (gtmpqGetnchar((char *)xip, sizeof (GlobalTransactionId) * xcnt, conn)) { result->gr_status = GTM_RESULT_ERROR; @@ -563,7 +563,7 @@ gtmpqParseSuccess(GTM_Conn *conn, GTM_Result *result) result->gr_status = GTM_RESULT_ERROR; break; } - + result->gr_resdata.grd_seq_list.seq = (GTM_SeqInfo **)malloc(sizeof(GTM_SeqInfo *) * result->gr_resdata.grd_seq_list.seq_count); @@ -622,7 +622,7 @@ gtmpqParseSuccess(GTM_Conn *conn, GTM_Result *result) if (result->gr_resdata.grd_txn_get_gid_data.nodelen != 0) { /* Do necessary allocation */ - result->gr_resdata.grd_txn_get_gid_data.nodestring = + result->gr_resdata.grd_txn_get_gid_data.nodestring = (char *)malloc(sizeof(char *) * result->gr_resdata.grd_txn_get_gid_data.nodelen + 1); if (result->gr_resdata.grd_txn_get_gid_data.nodestring == NULL) { @@ -774,7 +774,7 @@ gtmpqReadSeqKey(GTM_SequenceKey seqkey, GTM_Conn *conn) */ if (seqkey->gsk_keylen <= 0 || seqkey->gsk_keylen > GTM_MAX_SEQKEY_LENGTH) return EINVAL; - + if ((seqkey->gsk_key = (char *) malloc(seqkey->gsk_keylen)) == NULL) return ENOMEM; diff --git a/src/gtm/common/gtm_lock.c b/src/gtm/common/gtm_lock.c index aedc7de315..a3e0b88f6a 100644 --- a/src/gtm/common/gtm_lock.c +++ b/src/gtm/common/gtm_lock.c @@ -154,7 +154,7 @@ GTM_MutexLockRelease(GTM_MutexLock *lock) bool GTM_MutexLockConditionalAcquire(GTM_MutexLock *lock) { - int status = pthread_mutex_trylock(&lock->lk_lock); + int status = pthread_mutex_trylock(&lock->lk_lock); return status ? false : true; } @@ -203,4 +203,3 @@ GTM_CVWait(GTM_CV *cv, GTM_MutexLock *lock) { return pthread_cond_wait(&cv->cv_condvar, &lock->lk_lock); } - diff --git a/src/gtm/common/gtm_opt_handler.c b/src/gtm/common/gtm_opt_handler.c index 40fbcc935d..61c2476599 100644 --- a/src/gtm/common/gtm_opt_handler.c +++ b/src/gtm/common/gtm_opt_handler.c @@ -1398,7 +1398,7 @@ SelectConfigFiles(const char *userDoption, const char *progname) { if (configdir) { - fname = gtm_opt_malloc(FATAL, + fname = gtm_opt_malloc(FATAL, strlen(configdir) + strlen(GTMConfigFileName) + 2); sprintf(fname, "%s/%s", configdir, GTMConfigFileName); } @@ -3205,7 +3205,7 @@ _ShowOption(struct config_generic * record, bool use_units) snprintf(buffer, sizeof(buffer), INT64_FORMAT "%s", result, unit); val = buffer; - + } break; diff --git a/src/gtm/common/gtm_serialize.c b/src/gtm/common/gtm_serialize.c index 78626c5d89..bb8e368d7c 100644 --- a/src/gtm/common/gtm_serialize.c +++ b/src/gtm/common/gtm_serialize.c @@ -80,18 +80,18 @@ gtm_serialize_snapshotdata(GTM_SnapshotData *data, char *buf, size_t buflen) /* GTM_SnapshotData.sn_xmax */ memcpy(buf + len, &(data->sn_xmax), sizeof(GlobalTransactionId)); len += sizeof(GlobalTransactionId); - + /* GTM_SnapshotData.sn_recent_global_xmin */ memcpy(buf + len, &(data->sn_recent_global_xmin), sizeof(GlobalTransactionId)); len += sizeof(GlobalTransactionId); - + /* GTM_SnapshotData.sn_xcnt */ memcpy(buf + len, &(data->sn_xcnt), sizeof(uint32)); len += sizeof(uint32); - + /* GTM_SnapshotData.sn_xip */ #if 0 - /* + /* * This block of code seems to be wrong. data->sn_xip is an array of GlobalTransacionIDs * and the number of elements are indicated by sn_xcnt. */ diff --git a/src/gtm/common/gtm_serialize_debug.c b/src/gtm/common/gtm_serialize_debug.c index 2c3eab38ad..10a8f05189 100644 --- a/src/gtm/common/gtm_serialize_debug.c +++ b/src/gtm/common/gtm_serialize_debug.c @@ -47,7 +47,7 @@ dump_transactioninfo_elog(GTM_TransactionInfo *txn) elog(LOG, "gti_backend_id: %d", txn->gti_backend_id); elog(LOG, "gti_nodestring: %s", txn->nodestring); elog(LOG, "gti_gid: %s", txn->gti_gid); - + elog(LOG, " sn_xmin: %d", txn->gti_current_snapshot.sn_xmin); elog(LOG, " sn_xmax: %d", txn->gti_current_snapshot.sn_xmax); elog(LOG, " sn_recent_global_xmin: %d", txn->gti_current_snapshot.sn_recent_global_xmin); @@ -81,7 +81,7 @@ dump_transactions_elog(GTM_Transactions *txn, int num_txn) elog(LOG, " gt_latestCompletedXid: %d", txn->gt_latestCompletedXid); elog(LOG, " gt_recent_global_xmin: %d", txn->gt_recent_global_xmin); elog(LOG, " gt_lastslot: %d", txn->gt_lastslot); - + for (i = 0; i < num_txn; i++) { if (txn->gt_transactions_array[i].gti_gxid != InvalidGlobalTransactionId) diff --git a/src/gtm/common/gtm_utils.c b/src/gtm/common/gtm_utils.c index 828bc66c77..cc28712724 100644 --- a/src/gtm/common/gtm_utils.c +++ b/src/gtm/common/gtm_utils.c @@ -217,4 +217,3 @@ gtm_report_failure(GTM_Conn *failed_conn) return; } #endif - diff --git a/src/gtm/common/mcxt.c b/src/gtm/common/mcxt.c index 4ee938a85b..f032e1e55b 100644 --- a/src/gtm/common/mcxt.c +++ b/src/gtm/common/mcxt.c @@ -126,7 +126,7 @@ MemoryContextReset(MemoryContext context) if (MemoryContextIsShared(context)) MemoryContextLock(context); - + /* save a function call in common case where there are no children */ if (context->firstchild != NULL) MemoryContextResetChildren(context); @@ -782,4 +782,3 @@ Gen_Alloc genAlloc_class = {(void *)MemoryContextAlloc, (void *)pfree, (void *)current_memcontext, (void *)allocTopMemCxt}; - diff --git a/src/gtm/gtm_ctl/gtm_ctl.c b/src/gtm/gtm_ctl/gtm_ctl.c index 1ebad1b306..9f2143c0d2 100644 --- a/src/gtm/gtm_ctl/gtm_ctl.c +++ b/src/gtm/gtm_ctl/gtm_ctl.c @@ -270,7 +270,7 @@ start_gtm(void) if (gtm_path != NULL) { strncpy(gtm_app_path, gtm_path, MAXPGPATH - len - 1); - + len = strlen(gtm_app_path); strncat(gtm_app_path, "/", MAXPGPATH - len - 1); @@ -291,7 +291,7 @@ start_gtm(void) else len = snprintf(cmd, MAXPGPATH - 1, SYSTEMQUOTE "\"%s\" %s%s < \"%s\" 2>&1 &" SYSTEMQUOTE, gtm_app_path, gtmdata_opt, gtm_opts, DEVNULL); - + if (len >= MAXPGPATH - 1) { write_stderr("gtm command exceeds max size"); @@ -653,7 +653,7 @@ do_reconnect(void) exit(1); } } - + /* * restart/reload routines @@ -1071,7 +1071,7 @@ main(int argc, char **argv) ctl_command = RECONNECT_COMMAND; else { - write_stderr(_("%s: unrecognized operation mode \"%s\"\n"), + write_stderr(_("%s: unrecognized operation mode \"%s\"\n"), progname, argv[optind]); do_advice(); exit(1); @@ -1220,4 +1220,4 @@ pg_realloc(void *ptr, size_t size) if (!tmp) write_stderr("out of memory\n"); return tmp; -} +} diff --git a/src/gtm/libpq/pqcomm.c b/src/gtm/libpq/pqcomm.c index 7633a62c96..292b3c035b 100644 --- a/src/gtm/libpq/pqcomm.c +++ b/src/gtm/libpq/pqcomm.c @@ -912,7 +912,7 @@ pq_putmessage(Port *myport, char msgtype, const char *s, size_t len) n32 = htonl((uint32) (len + 4)); if (internal_putbytes(myport, (char *) &n32, 4)) goto fail; - + if (internal_putbytes(myport, s, len)) goto fail; return 0; diff --git a/src/gtm/main/gtm_seq.c b/src/gtm/main/gtm_seq.c index 32f4da48f3..b050e7a411 100644 --- a/src/gtm/main/gtm_seq.c +++ b/src/gtm/main/gtm_seq.c @@ -198,7 +198,7 @@ seq_remove_seqinfo(GTM_SeqInfo *seqinfo) { uint32 hash = seq_gethash(seqinfo->gs_key); GTM_SeqInfoHashBucket *bucket; - + bucket = >MSequences[hash]; GTM_RWLockAcquire(&bucket->shb_lock, GTM_LOCKMODE_WRITE); @@ -223,7 +223,7 @@ static GTM_SequenceKey seq_copy_key(GTM_SequenceKey key) { GTM_SequenceKey retkey = NULL; - + /* * We must use the TopMostMemoryContext because the sequence information is * not bound to a thread and can outlive any of the thread specific @@ -291,7 +291,7 @@ GTM_SeqOpen(GTM_SequenceKey seqkey, * If maxval is specfied, set the maxvalue to the given maxval, otherwise * set to the defaults depending on whether the seqeunce is ascending or * descending. Also do some basic contraint checks - */ + */ if (SEQVAL_IS_VALID(maxval)) { if (maxval < seqinfo->gs_min_value) @@ -732,7 +732,7 @@ GTM_SeqGetNext(GTM_SequenceKey seqkey) } GTM_RWLockAcquire(&seqinfo->gs_lock, GTM_LOCKMODE_WRITE); - + /* * If the sequence is called for the first time, initialize the value and * return the start value @@ -866,7 +866,7 @@ ProcessSequenceInitCommand(Port *myport, StringInfo message, bool is_backup) sizeof (GTM_Sequence)); memcpy(&startval, pq_getmsgbytes(message, sizeof (GTM_Sequence)), sizeof (GTM_Sequence)); - + cycle = pq_getmsgbyte(message); @@ -907,7 +907,7 @@ ProcessSequenceInitCommand(Port *myport, StringInfo message, bool is_backup) maxval, startval, cycle); - + if (gtm_standby_check_communication_error(&count, oldconn)) goto retry; @@ -1010,7 +1010,7 @@ ProcessSequenceAlterCommand(Port *myport, StringInfo message, bool is_backup) int count = 0; elog(LOG, "calling alter_sequence() for standby GTM %p.", GetMyThreadInfo->thr_conn->standby); - + retry: rc = bkup_alter_sequence(GetMyThreadInfo->thr_conn->standby, &seqkey, @@ -1021,14 +1021,14 @@ ProcessSequenceAlterCommand(Port *myport, StringInfo message, bool is_backup) lastval, cycle, is_restart); - + if (gtm_standby_check_communication_error(&count, oldconn)) goto retry; /* Sync */ if (Backup_synchronously && (myport->remote_type != GTM_NODE_GTM_PROXY)) gtm_sync_standby(GetMyThreadInfo->thr_conn->standby); - + elog(LOG, "alter_sequence() returns rc %d.", rc); } pq_beginmessage(&buf, 'S'); @@ -1087,7 +1087,7 @@ ProcessSequenceListCommand(Port *myport, StringInfo message) { GTM_SeqInfoHashBucket *b; gtm_ListCell *elem; - + for (i = 0 ; i < SEQ_HASH_TABLE_SIZE ; i++) { b = >MSequences[i]; @@ -1120,7 +1120,7 @@ ProcessSequenceListCommand(Port *myport, StringInfo message) /* Send a number of sequences */ pq_sendint(&buf, seq_count, 4); - + for (i = 0 ; i < seq_count ; i++) { char *seq_buf; @@ -1187,7 +1187,7 @@ ProcessSequenceGetCurrentCommand(Port *myport, StringInfo message) /* Don't flush to the standby because this does not change the status */ pq_flush(myport); - /* + /* * I don't think backup is needed here. It does not change internal state. * 27th Dec., 2011, K.Suzuki */ @@ -1249,7 +1249,7 @@ ProcessSequenceGetNextCommand(Port *myport, StringInfo message, bool is_backup) retry: loc_seq = bkup_get_next(GetMyThreadInfo->thr_conn->standby, &seqkey); - + if (gtm_standby_check_communication_error(&count, oldconn)) goto retry; @@ -1340,13 +1340,13 @@ ProcessSequenceSetValCommand(Port *myport, StringInfo message, bool is_backup) int count = 0; elog(LOG, "calling set_val() for standby GTM %p.", GetMyThreadInfo->thr_conn->standby); - + retry: rc = bkup_set_val(GetMyThreadInfo->thr_conn->standby, &seqkey, nextval, iscalled); - + if (gtm_standby_check_communication_error(&count, oldconn)) goto retry; @@ -1413,7 +1413,7 @@ ProcessSequenceResetCommand(Port *myport, StringInfo message, bool is_backup) int count = 0; elog(LOG, "calling reset_sequence() for standby GTM %p.", GetMyThreadInfo->thr_conn->standby); - + retry: rc = bkup_reset_sequence(GetMyThreadInfo->thr_conn->standby, &seqkey); @@ -1687,7 +1687,7 @@ GTM_RestoreSeqInfo(int ctlfd) elog(LOG, "Failed to read keylen"); break; } - + seqkey.gsk_key = palloc(seqkey.gsk_keylen); read(ctlfd, seqkey.gsk_key, seqkey.gsk_keylen); diff --git a/src/gtm/main/gtm_snap.c b/src/gtm/main/gtm_snap.c index 90801e8988..1ef0c84552 100644 --- a/src/gtm/main/gtm_snap.c +++ b/src/gtm/main/gtm_snap.c @@ -124,7 +124,7 @@ GTM_GetTransactionSnapshot(GTM_TransactionHandle handle[], int txn_count, int *s * Spin over transaction list checking xid, xmin, and subxids. The goal is to * gather all active xids and find the lowest xmin */ - gtm_foreach(elem, GTMTransactions.gt_open_transactions) + gtm_foreach(elem, GTMTransactions.gt_open_transactions) { volatile GTM_TransactionInfo *gtm_txninfo = (GTM_TransactionInfo *)gtm_lfirst(elem); GlobalTransactionId xid; @@ -203,7 +203,7 @@ GTM_GetTransactionSnapshot(GTM_TransactionHandle handle[], int txn_count, int *s mygtm_txninfo = GTM_HandleToTransactionInfo(handle[ii]); mysnap = &mygtm_txninfo->gti_current_snapshot; - + if (GTM_IsTransSerializable(mygtm_txninfo)) { if ((mygtm_txninfo->gti_snapshot_set) && (txn_count > 1)) @@ -464,7 +464,7 @@ retry: _rc = snapshot_get_multi(GetMyThreadInfo->thr_conn->standby, txn_count, gxid, &txn_count_out, status_out, &xmin_out, &xmax_out, &recent_global_xmin_out, &xcnt_out); - + if (gtm_standby_check_communication_error(&count, oldconn)) goto retry; diff --git a/src/gtm/main/gtm_standby.c b/src/gtm/main/gtm_standby.c index 1c51c9c843..e641c9f7c4 100644 --- a/src/gtm/main/gtm_standby.c +++ b/src/gtm/main/gtm_standby.c @@ -88,7 +88,7 @@ gtm_standby_restore_sequence(void) * Restore sequence data. */ num_seq = get_sequence_list(GTM_ActiveConn, seq_list, 1024); - + for (i = 0; i < num_seq; i++) { GTM_SeqRestore(seq_list[i]->gs_key, @@ -165,7 +165,7 @@ gtm_standby_restore_gxid(void) txn.gt_transactions_array[i].gti_current_snapshot.sn_recent_global_xmin; GTMTransactions.gt_transactions_array[i].gti_current_snapshot.sn_xcnt = txn.gt_transactions_array[i].gti_current_snapshot.sn_xcnt; - GTMTransactions.gt_transactions_array[i].gti_current_snapshot.sn_xip = + GTMTransactions.gt_transactions_array[i].gti_current_snapshot.sn_xip = txn.gt_transactions_array[i].gti_current_snapshot.sn_xip; /* end of copying GTM_SnapshotData */ @@ -184,7 +184,7 @@ gtm_standby_restore_gxid(void) >MTransactions.gt_transactions_array[i]); } } - + dump_transactions_elog(>MTransactions, num_txn); GTM_RWLockRelease(>MTransactions.gt_XidGenLock); @@ -331,7 +331,7 @@ find_standby_node_info(void) node[i]->port, node[i]->status); - if ( (strcmp(standbyNodeName, node[i]->nodename) != 0) && + if ( (strcmp(standbyNodeName, node[i]->nodename) != 0) && node[i]->status == NODE_CONNECTED) return node[i]; } @@ -380,13 +380,13 @@ gtm_standby_connect_to_standby_int(int *report_needed) return NULL; n = find_standby_node_info(); - + if (!n) { elog(LOG, "Any GTM standby node not found in registered node(s)."); return NULL; } - + elog(LOG, "GTM standby is active. Going to connect."); *report_needed = 1; @@ -395,7 +395,7 @@ gtm_standby_connect_to_standby_int(int *report_needed) n->ipaddress, n->port, NodeName); standby = PQconnectGTM(conn_string); - + if ( !standby ) { elog(LOG, "Failed to establish a connection with GTM standby. - %p", n); @@ -465,7 +465,7 @@ gtm_standby_check_communication_error(int *retry_count, GTM_Conn *oldconn) /* * This function may be called without result from standby. */ - if (my_threadInfo->thr_conn->standby->result + if (my_threadInfo->thr_conn->standby->result && my_threadInfo->thr_conn->standby->result->gr_status == GTM_RESULT_COMM_ERROR) { if (*retry_count == 0) @@ -538,6 +538,6 @@ gtm_standby_connectToActiveGTM(void) sprintf(connect_string, "host=%s port=%d node_name=%s remote_type=%d", active_address, active_port, NodeName, GTM_NODE_GTM); - + return PQconnectGTM(connect_string); } diff --git a/src/gtm/main/gtm_stats.c b/src/gtm/main/gtm_stats.c index 297af7eed9..b9a934e1d7 100644 --- a/src/gtm/main/gtm_stats.c +++ b/src/gtm/main/gtm_stats.c @@ -19,5 +19,3 @@ typedef struct GTM_Stats float GTM_RecvBytes; float GTM_SentBytes; } GTM_Stats; - - diff --git a/src/gtm/main/gtm_thread.c b/src/gtm/main/gtm_thread.c index 045b317ce7..d0329a8169 100644 --- a/src/gtm/main/gtm_thread.c +++ b/src/gtm/main/gtm_thread.c @@ -395,4 +395,3 @@ GTM_DoForAllOtherThreads(void (* process_routine)(GTM_ThreadInfo *)) (process_routine)(GTMThreads->gt_threads[ii]); } } - diff --git a/src/gtm/main/gtm_txn.c b/src/gtm/main/gtm_txn.c index d45a9e2448..f507c988e2 100644 --- a/src/gtm/main/gtm_txn.c +++ b/src/gtm/main/gtm_txn.c @@ -63,14 +63,14 @@ GTM_InitTxnManager(void) * trickier for GTM failures. * * TODO We skip this part for the prototype. - */ + */ GTMTransactions.gt_nextXid = FirstNormalGlobalTransactionId; /* * XXX The gt_oldestXid is the cluster level oldest Xid */ GTMTransactions.gt_oldestXid = FirstNormalGlobalTransactionId; - + /* * XXX Compute various xid limits to avoid wrap-around related database * corruptions. Again, this is not implemented for the prototype @@ -84,7 +84,7 @@ GTM_InitTxnManager(void) * XXX Newest XID that is committed or aborted */ GTMTransactions.gt_latestCompletedXid = FirstNormalGlobalTransactionId; - + /* * Initialize the locks to protect various XID fields as well as the linked * list of transactions @@ -293,7 +293,7 @@ GTM_RemoveAllTransInfos(int backend_id) GTM_ThreadID thread_id; thread_id = pthread_self(); - + /* * Scan the global list of open transactions */ @@ -605,7 +605,7 @@ ReadNewGlobalTransactionId(void) { GlobalTransactionId xid; - GTM_RWLockAcquire(>MTransactions.gt_XidGenLock, GTM_LOCKMODE_READ); + GTM_RWLockAcquire(>MTransactions.gt_XidGenLock, GTM_LOCKMODE_READ); xid = GTMTransactions.gt_nextXid; GTM_RWLockRelease(>MTransactions.gt_XidGenLock); @@ -619,12 +619,12 @@ ReadNewGlobalTransactionId(void) * started. When the GTM is finally shutdown, the next to-be-assigned GXID is * stroed in the control file. * - * XXX We don't yet handle any crash recovery. So if the GTM is shutdown + * XXX We don't yet handle any crash recovery. So if the GTM is shutdown */ void SetNextGlobalTransactionId(GlobalTransactionId gxid) { - GTM_RWLockAcquire(>MTransactions.gt_XidGenLock, GTM_LOCKMODE_WRITE); + GTM_RWLockAcquire(>MTransactions.gt_XidGenLock, GTM_LOCKMODE_WRITE); GTMTransactions.gt_nextXid = gxid; GTMTransactions.gt_gtm_state = GTM_RUNNING; GTM_RWLockRelease(>MTransactions.gt_XidGenLock); @@ -749,7 +749,7 @@ init_GTM_TransactionInfo(GTM_TransactionInfo *gtm_txninfo, gtm_txninfo->gti_vacuum = false; gtm_txninfo->gti_thread_id = pthread_self(); } - + void GTM_BkupBeginTransactionMulti(char *coord_name, @@ -815,7 +815,7 @@ GTM_RollbackTransactionMulti(GTM_TransactionHandle txn[], int txn_count, int sta { GTM_TransactionInfo *gtm_txninfo[txn_count]; int ii; - + for (ii = 0; ii < txn_count; ii++) { gtm_txninfo[ii] = GTM_HandleToTransactionInfo(txn[ii]); @@ -870,7 +870,7 @@ GTM_CommitTransactionMulti(GTM_TransactionHandle txn[], int txn_count, int statu { GTM_TransactionInfo *gtm_txninfo[txn_count]; int ii; - + for (ii = 0; ii < txn_count; ii++) { gtm_txninfo[ii] = GTM_HandleToTransactionInfo(txn[ii]); @@ -1124,7 +1124,7 @@ ProcessBkupBeginTransactionCommand(Port *myport, StringInfo message) GTM_BkupBeginTransaction("", txn, txn_isolation_level, txn_read_only); MemoryContextSwitchTo(oldContext); -} +} /* * Process MSG_TXN_BEGIN_GETGXID message @@ -1178,7 +1178,7 @@ ProcessBeginTransactionGetGXIDCommand(Port *myport, StringInfo message) elog(LOG, "calling begin_transaction() for standby GTM %p.", GetMyThreadInfo->thr_conn->standby); retry: - bkup_begin_transaction_gxid(GetMyThreadInfo->thr_conn->standby, + bkup_begin_transaction_gxid(GetMyThreadInfo->thr_conn->standby, txn, gxid, txn_isolation_level, txn_read_only, timestamp); if (gtm_standby_check_communication_error(&count, oldconn)) @@ -1187,7 +1187,7 @@ retry: /* Sync */ if (Backup_synchronously && (myport->remote_type != GTM_NODE_GTM_PROXY)) gtm_sync_standby(GetMyThreadInfo->thr_conn->standby); - + } /* Respond to the client */ pq_beginmessage(&buf, 'S'); @@ -1269,7 +1269,7 @@ GTM_BkupBeginTransactionGetGXID(char *coord_name, GTM_BkupBeginTransactionGetGXIDMulti(coord_name, &txn, &gxid, &isolevel, &readonly, &connid, 1); } - + /* * Process MSG_BKUP_TXN_BEGIN_GETGXID message */ @@ -1452,7 +1452,7 @@ ProcessBeginTransactionGetGXIDCommandMulti(Port *myport, StringInfo message) errmsg("Failed to get a new transaction id"))); MemoryContextSwitchTo(oldContext); - + /* GXID has been received, now it's time to get a GTM timestamp */ timestamp = GTM_TimestampGetCurrent(); @@ -1480,7 +1480,7 @@ retry: txn_isolation_level, txn_read_only, txn_connid); - + if (gtm_standby_check_communication_error(&count, oldconn)) goto retry; @@ -1528,7 +1528,7 @@ ProcessBkupBeginTransactionGetGXIDCommandMulti(Port *myport, StringInfo message) bool txn_read_only[GTM_MAX_GLOBAL_TRANSACTIONS]; GTMProxy_ConnID txn_connid[GTM_MAX_GLOBAL_TRANSACTIONS]; int ii; - + txn_count = pq_getmsgint(message, sizeof(int)); if (txn_count <= 0) elog(PANIC, "Zero or less transaction count."); @@ -2011,7 +2011,7 @@ ProcessRollbackTransactionCommand(Port *myport, StringInfo message, bool is_back /* Sync */ if (Backup_synchronously && (myport->remote_type != GTM_NODE_GTM_PROXY)) gtm_sync_standby(GetMyThreadInfo->thr_conn->standby); - + elog(LOG, "abort_transaction() GXID=%d done.", gxid); } /* Respond to the client */ @@ -2110,7 +2110,7 @@ ProcessCommitTransactionCommandMulti(Port *myport, StringInfo message, bool is_b retry: _rc = bkup_commit_transaction_multi(GetMyThreadInfo->thr_conn->standby, txn_count, txn); - + if (gtm_standby_check_communication_error(&count, oldconn)) goto retry; /* Sync */ @@ -2213,7 +2213,7 @@ ProcessRollbackTransactionCommandMulti(Port *myport, StringInfo message, bool is retry: _rc = bkup_abort_transaction_multi(GetMyThreadInfo->thr_conn->standby, txn_count, gxid); - + if (gtm_standby_check_communication_error(&count, oldconn)) goto retry; @@ -2293,7 +2293,7 @@ ProcessStartPreparedTransactionCommand(Port *myport, StringInfo message, bool is gid[gidlen] = '\0'; /* get node string list */ - nodelen = pq_getmsgint(message, sizeof (GTM_StrLen)); + nodelen = pq_getmsgint(message, sizeof (GTM_StrLen)); memcpy(nodestring, (char *)pq_getmsgbytes(message, nodelen), nodelen); nodestring[nodelen] = '\0'; @@ -2454,7 +2454,7 @@ ProcessPrepareTransactionCommand(Port *myport, StringInfo message, bool is_backu } } return; - + } @@ -2622,4 +2622,3 @@ int GTM_GetAllTransactions(GTM_TransactionInfo txninfo[], uint32 txncnt); * TODO */ uint32 GTM_GetAllPrepared(GlobalTransactionId gxids[], uint32 gxidcnt); - diff --git a/src/gtm/main/main.c b/src/gtm/main/main.c index cb6ceb018e..cca3c5d1cd 100644 --- a/src/gtm/main/main.c +++ b/src/gtm/main/main.c @@ -119,14 +119,14 @@ static void ProcessSyncStandbyCommand(Port *myport, GTM_MessageType mtype, Strin /* * One-time initialization. It's called immediately after the main process * starts - */ + */ static GTM_ThreadInfo * MainThreadInit() { GTM_ThreadInfo *thrinfo; pthread_key_create(&threadinfo_key, NULL); - + /* * Initialize the lock protecting the global threads info */ @@ -248,7 +248,7 @@ GTM_SigleHandler(int signal) } /* - * Help display should match + * Help display should match */ static void help(const char *progname) @@ -320,7 +320,7 @@ main(int argc, char *argv[]) char *is_standby_mode = NULL; char *dest_addr = NULL; char *dest_port = NULL; - + isStartUp = true; /* @@ -341,7 +341,7 @@ main(int argc, char *argv[]) ListenAddresses = strdup(GTM_DEFAULT_HOSTNAME); GTMPortNumber = GTM_DEFAULT_PORT; - + /* * Parse the command like options and set variables */ @@ -405,7 +405,7 @@ main(int argc, char *argv[]) free(dest_port); dest_port = strdup(optarg); break; - + default: write_stderr("Try \"%s --help\" for more information.\n", progname); @@ -446,7 +446,7 @@ main(int argc, char *argv[]) } if (listen_addresses) { - SetConfigOption(GTM_OPTNAME_LISTEN_ADDRESSES, + SetConfigOption(GTM_OPTNAME_LISTEN_ADDRESSES, listen_addresses, GTMC_STARTUP, GTMC_S_OVERRIDE); free(listen_addresses); listen_addresses = NULL; @@ -667,7 +667,7 @@ main(int argc, char *argv[]) pqsignal(SIGUSR1, GTM_SigleHandler); pqinitmask(); - + /* * Now, activating a standby GTM... */ @@ -755,7 +755,7 @@ ServerLoop(void) int selres; //MemoryContextStats(TopMostMemoryContext); - + /* * Wait for a connection request to arrive. * @@ -821,7 +821,7 @@ ServerLoop(void) timeout.tv_sec = 60; timeout.tv_usec = 0; - /* + /* * Now GTM-Standby can backup current status during this region */ GTM_RWLockRelease(&my_threadinfo->thr_lock); @@ -875,7 +875,7 @@ ServerLoop(void) GTM_Conn *standby = NULL; standby = gtm_standby_connect_to_standby(); - + if (GTMAddConnection(port, standby) != STATUS_OK) { @@ -931,7 +931,7 @@ GTM_ThreadMain(void *argp) sigjmp_buf local_sigjmp_buf; elog(DEBUG3, "Starting the connection helper thread"); - + /* * Create the memory context we will use in the main loop. @@ -972,7 +972,7 @@ GTM_ThreadMain(void *argp) startup_type))); initStringInfo(&inBuf); - + /* * All frontend messages have a length word next * after the type code; we can read the message contents independently of @@ -1038,7 +1038,7 @@ GTM_ThreadMain(void *argp) * should be stuff that is guaranteed to apply *only* for outer-level * error recovery, such as adjusting the FE/BE protocol status. */ - + /* Report the error to the client and/or server log */ if (thrinfo->thr_conn) EmitErrorReport(thrinfo->thr_conn->con_port); @@ -1111,12 +1111,12 @@ GTM_ThreadMain(void *argp) case 'C': ProcessCommand(thrinfo->thr_conn->con_port, &input_message); break; - + case 'X': case EOF: /* * Connection termination request - * Remove all transactions opened within the thread + * Remove all transactions opened within the thread */ GTM_RemoveAllTransInfos(-1); @@ -1125,7 +1125,7 @@ GTM_ThreadMain(void *argp) GTM_RWLockRelease(&thrinfo->thr_lock); pthread_exit(thrinfo); break; - + case 'F': /* * Flush all the outgoing data on the wire. Consume the message @@ -1146,7 +1146,7 @@ GTM_ThreadMain(void *argp) default: /* - * Remove all transactions opened within the thread + * Remove all transactions opened within the thread */ GTM_RemoveAllTransInfos(-1); @@ -1159,7 +1159,7 @@ GTM_ThreadMain(void *argp) qtype))); break; } - + } /* can't get here because the above loop never exits */ @@ -1182,7 +1182,7 @@ ProcessCommand(Port *myport, StringInfo input_message) myport->conn_id = proxyhdr.ph_conid; mtype = pq_getmsgint(input_message, sizeof (GTM_MessageType)); - /* + /* * The next line will have some overhead. Better to be in * compile option. */ diff --git a/src/gtm/path/path.c b/src/gtm/path/path.c index 1c85efb386..84779658a9 100644 --- a/src/gtm/path/path.c +++ b/src/gtm/path/path.c @@ -299,4 +299,3 @@ join_path_components(char *ret_path, snprintf(ret_path + strlen(ret_path), MAXPGPATH - strlen(ret_path), "/%s", tail); } - diff --git a/src/gtm/proxy/gtm_proxy_opt.c b/src/gtm/proxy/gtm_proxy_opt.c index f9e1b027e1..7459e29de1 100644 --- a/src/gtm/proxy/gtm_proxy_opt.c +++ b/src/gtm/proxy/gtm_proxy_opt.c @@ -243,7 +243,7 @@ struct config_int ConfigureNamesInt[] = { GTM_OPTNAME_KEEPALIVES_COUNT, GTMC_STARTUP, gettext_noop("Sets \"keepalives_count\" option to the connection to GTM."), - NULL, + NULL, 0 }, &tcp_keepalives_count, diff --git a/src/gtm/proxy/proxy_main.c b/src/gtm/proxy/proxy_main.c index 65985217d3..2cc78f7dfd 100644 --- a/src/gtm/proxy/proxy_main.c +++ b/src/gtm/proxy/proxy_main.c @@ -194,14 +194,14 @@ static void workerThreadReconnectToGTM(void); /* * One-time initialization. It's called immediately after the main process * starts - */ + */ static GTMProxy_ThreadInfo * MainThreadInit() { GTMProxy_ThreadInfo *thrinfo; pthread_key_create(&threadinfo_key, NULL); - + /* * Initialize the lock protecting the global threads info */ @@ -541,7 +541,7 @@ GTMProxy_SigleHandler(int signal) } /* - * Help display should match + * Help display should match */ static void help(const char *progname) @@ -702,7 +702,7 @@ main(int argc, char *argv[]) * Setup configuration file */ if (!SelectConfigFiles(data_dir, progname)) - exit(1); + exit(1); /* * Parse config file @@ -1014,7 +1014,7 @@ ServerLoop(void) { /* * Tell everybody that we are shutting down - * + * * !! TODO */ exit(1); @@ -1312,13 +1312,13 @@ GTMProxy_ThreadMain(void *argp) /* * Detect if the connection has been dropped to avoid - * a segmentation fault. + * a segmentation fault. */ if (conninfo->con_port == NULL) { conninfo->con_disconnected = true; continue; - } + } /* * If this is a newly added connection, complete the handshake @@ -1403,7 +1403,7 @@ setjmp_again: * handle any memory leaks */ resetStringInfo(&input_message); - + /* * Now, read command from each of the connections that has some data to * be read. @@ -1574,7 +1574,7 @@ GTMProxyAddConnection(Port *port) errmsg("Out of memory"))); return STATUS_ERROR; } - + elog(DEBUG3, "Started new connection"); conninfo->con_port = port; @@ -1675,7 +1675,7 @@ HandleGTMError(GTM_Conn *gtm_conn) int ii; char gtm_connect_string[1024]; - elog(NOTICE, + elog(NOTICE, "GTM communication error was detected. Retrying connection. idle: %d, count = %d, interval = %d.", GTMConnectRetryIdle, GTMConnectRetryCount, GTMConnectRetryInterval); GTMPQfinish(gtm_conn); @@ -1689,8 +1689,8 @@ HandleGTMError(GTM_Conn *gtm_conn) /* GTM connection retry */ for (ii = 0; ii < GTMConnectRetryCount; ii++) { - /* - * Connect retry + /* + * Connect retry * Because this proxy has been registered to current * GTM, we don't re-register it. * @@ -1724,7 +1724,7 @@ HandleGTMError(GTM_Conn *gtm_conn) * GTM communication error detected, retry failed * but cannot wait for reconnect. */ - elog(FATAL, + elog(FATAL, "No action specified to wait for reconnect."); exit(1); /* Just in case */ } @@ -1738,8 +1738,8 @@ HandleGTMError(GTM_Conn *gtm_conn) * * For details, see gtm_proxy.h. */ - elog(NOTICE, - "Waiting for reconnect action from gtm_ctl. idie: %d, count: %d, interval:%d", + elog(NOTICE, + "Waiting for reconnect action from gtm_ctl. idie: %d, count: %d, interval:%d", GTMErrorWaitIdle, GTMErrorWaitCount, GTMErrorWaitInterval); Disable_Longjmp(); elog(DEBUG1, "Witing %d secs.", GTMErrorWaitIdle); @@ -1989,7 +1989,7 @@ ProcessResponse(GTMProxy_ThreadInfo *thrinfo, GTMProxy_CommandInfo *cmdinfo, * * !!TODO As we start adding support for message grouping for * messages, those message types would be removed from the above - * and handled separately. + * and handled separately. */ switch (res->gr_status) { @@ -2036,7 +2036,7 @@ ReadCommand(GTMProxy_ConnectionInfo *conninfo, StringInfo inBuf) int anyBackup; anyBackup = (GetMyThreadInfo->thr_any_backup[connIdx] ? TRUE : FALSE); - + /* * Get message type code from the frontend. */ @@ -2105,9 +2105,9 @@ ReadCommand(GTMProxy_ConnectionInfo *conninfo, StringInfo inBuf) copyStringInfo(&(GetMyThreadInfo->thr_inBufData[connIdx]), inBuf); - /* + /* * The next line is added because we added the code to clear backup - * when the response is processed. + * when the response is processed. */ GetMyThreadInfo->thr_any_backup[connIdx] = TRUE; } @@ -2307,7 +2307,7 @@ ProcessTransactionCommand(GTMProxy_ConnectionInfo *conninfo, GTM_Conn *gtm_conn, GTMProxy_CommandPending(conninfo, mtype, cmd_data); break; - case MSG_TXN_BEGIN: + case MSG_TXN_BEGIN: case MSG_TXN_GET_GXID: elog(FATAL, "Support not yet added for these message types"); break; @@ -2573,7 +2573,7 @@ GTMProxy_HandshakeConnection(GTMProxy_ConnectionInfo *conninfo) startup_type))); initStringInfo(&inBuf); - + /* * All frontend messages have a length word next * after the type code; we can read the message contents independently of @@ -3231,7 +3231,7 @@ failed: * Register Proxy on GTM * * If reconnect is specified, then existing connection is closed - * and the target GTM is taken from NewGTMServerHost and + * and the target GTM is taken from NewGTMServerHost and * NewGTMServerPortNumber. */ static void diff --git a/src/gtm/proxy/proxy_thread.c b/src/gtm/proxy/proxy_thread.c index 50f17e2eee..ad8d155c4f 100644 --- a/src/gtm/proxy/proxy_thread.c +++ b/src/gtm/proxy/proxy_thread.c @@ -25,7 +25,7 @@ GTMProxy_Threads *GTMProxyThreads = >MProxyThreadsData; #define GTM_PROXY_MIN_THREADS 32 /* Provision for minimum threads */ #define GTM_PROXY_MAX_THREADS 1024 /* Max threads allowed in the GTMProxy */ -#define GTMProxyThreadsFull (GTMProxyThreads->gt_thread_count == GTMProxyThreads->gt_array_size) +#define GTMProxyThreadsFull (GTMProxyThreads->gt_thread_count == GTMProxyThreads->gt_array_size) extern int GTMProxyWorkerThreads; extern GTMProxy_ThreadInfo **Proxy_ThreadInfo; @@ -45,10 +45,10 @@ GTMProxy_ThreadAdd(GTMProxy_ThreadInfo *thrinfo) { GTMProxy_ThreadInfo **threads; uint32 newsize; - + /* * TODO Optimize lock management by not holding any locks during memory - * allocation + * allocation */ if (GTMProxyThreads->gt_array_size == GTM_PROXY_MAX_THREADS) elog(ERROR, "Too many threads active"); @@ -102,7 +102,7 @@ GTMProxy_ThreadAdd(GTMProxy_ThreadInfo *thrinfo) } GTM_RWLockRelease(>MProxyThreads->gt_lock); - /* + /* * Track the slot information in the thrinfo. This is useful to quickly * find the slot given the thrinfo structure. */ @@ -287,13 +287,13 @@ GTMProxy_ThreadCleanup(void *argp) /* * Reset the thread-specific information. This should be done only after we - * are sure that memory contextes are not required + * are sure that memory contextes are not required * * Note: elog calls need memory contextes, so no elog calls beyond this * point. */ SetMyThreadInfo(NULL); - + return; } @@ -311,7 +311,7 @@ GTMProxy_ThreadMainWrapper(void *argp) SetMyThreadInfo(thrinfo); MemoryContextSwitchTo(TopMemoryContext); - + pthread_cleanup_push(GTMProxy_ThreadCleanup, thrinfo); thrinfo->thr_startroutine(thrinfo); pthread_cleanup_pop(1); @@ -353,7 +353,7 @@ GTMProxy_ThreadAddConnection(GTMProxy_ConnectionInfo *conninfo) if (GTMProxyThreads->gt_next_worker == GTMProxyThreads->gt_thread_count) GTMProxyThreads->gt_next_worker = 1; - GTM_RWLockRelease(>MProxyThreads->gt_lock); + GTM_RWLockRelease(>MProxyThreads->gt_lock); /* * Lock the threadninfo structure to safely add the new connection to the @@ -361,7 +361,7 @@ GTMProxy_ThreadAddConnection(GTMProxy_ConnectionInfo *conninfo) * socket descriptor in the next cycle */ GTM_MutexLockAcquire(&thrinfo->thr_lock); - + if (thrinfo->thr_conn_count >= GTM_PROXY_MAX_CONNECTIONS) { GTM_MutexLockRelease(&thrinfo->thr_lock); @@ -412,7 +412,7 @@ GTMProxy_ThreadRemoveConnection(GTMProxy_ThreadInfo *thrinfo, GTMProxy_Connectio * thread structure. */ GTM_MutexLockAcquire(&thrinfo->thr_lock); - + for (ii = 0; ii < thrinfo->thr_conn_count; ii++) { if (thrinfo->thr_all_conns[ii] == conninfo) @@ -455,7 +455,7 @@ GTMProxy_ThreadRemoveConnection(GTMProxy_ThreadInfo *thrinfo, GTMProxy_Connectio thrinfo->thr_conn_count--; - /* + /* * Increment the seqno to ensure that the next time before we poll, the fd * array is reconstructed. */ diff --git a/src/gtm/proxy/proxy_utils.c b/src/gtm/proxy/proxy_utils.c index 3dd6890695..b4e7697528 100644 --- a/src/gtm/proxy/proxy_utils.c +++ b/src/gtm/proxy/proxy_utils.c @@ -40,7 +40,7 @@ * gtm.h and gtm_proxy.h and depends on the context. * * This is the reason why this dummy function is needed here. - * + * * The object and module structure of GTM/GTM Proxy needs review, and * fix to remove this kind of tricks. */ diff --git a/src/gtm/recovery/register_common.c b/src/gtm/recovery/register_common.c index 128b8bf341..f8f98ec8ac 100644 --- a/src/gtm/recovery/register_common.c +++ b/src/gtm/recovery/register_common.c @@ -48,7 +48,7 @@ static char GTMPGXCNodeFile[GTM_NODE_FILE_MAX_PATH]; static GTM_RWLock RegisterFileLock; static int NodeRegisterMagic = 0xeaeaeaea; -static int NodeUnregisterMagic = 0xebebebeb; +static int NodeUnregisterMagic = 0xebebebeb; static int NodeEndMagic = 0xefefefef; static GTM_PGXCNodeInfoHashBucket GTM_PGXCNodes[NODE_HASH_TABLE_SIZE]; @@ -862,4 +862,3 @@ retry: elog(LOG, "MSG_BACKEND_DISCONNECT rc=%d done.", _rc); } } - diff --git a/src/gtm/recovery/register_gtm.c b/src/gtm/recovery/register_gtm.c index a7423f8a39..6dcb393acf 100644 --- a/src/gtm/recovery/register_gtm.c +++ b/src/gtm/recovery/register_gtm.c @@ -483,4 +483,3 @@ finishStandbyConn(GTM_ThreadInfo *thrinfo) thrinfo->thr_conn->standby = NULL; } } - |