Skip to content

Commit

Permalink
remove parenthesis inside ereport
Browse files Browse the repository at this point in the history
  • Loading branch information
jsc0218 committed Sep 26, 2020
1 parent 46251e9 commit 9d97e5a
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 82 deletions.
4 changes: 2 additions & 2 deletions src/client/kv_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ static KVWorkerClient* GetKVWorkerClient(KVWorkerId workerId) {
return worker;
}

ereport(ERROR, (errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
ereport(ERROR, errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
errmsg("too many background workers"),
errhint("Up to %d background workers can be registered with"
" the current settings.", max_worker_processes),
errhint("Consider increasing the configuration parameter "
"\"max_worker_processes\".")));
"\"max_worker_processes\"."));
return nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ipc/kv_mq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void KVMessageQueue::Send(const KVMessage& msg) {

if (isServer_) {
if (msg.hdr.rpsId == 0) {
ereport(WARNING, (errmsg("invalid response channel")));
ereport(WARNING, errmsg("invalid response channel"));
return;
}

Expand All @@ -74,7 +74,7 @@ void KVMessageQueue::Recv(KVMessage& msg, int flag) {
channel = request_;
} else {
if (msg.hdr.rpsId == 0) {
ereport(WARNING, (errmsg("invalid response channel")));
ereport(WARNING, errmsg("invalid response channel"));
return;
}

Expand Down
24 changes: 12 additions & 12 deletions src/ipc/kv_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,61 +23,61 @@ extern "C" {
int ShmOpen(const char* name, int flag, mode_t mode, const char* func) {
int fd = shm_open(name, flag, mode);
if (fd == -1) {
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
return fd;
}

void ShmUnlink(const char* name, const char* func) {
if (shm_unlink(name) == -1) {
ereport(WARNING, (errmsg("%s %s failed", func, __func__),
errhint("maybe no shared memory to unlink")));
ereport(WARNING, errmsg("%s %s failed", func, __func__),
errhint("maybe no shared memory to unlink"));
}
}

void* Mmap(void* addr, size_t len, int prot, int flag, int fd, off_t offset,
const char* func) {
void* ptr = mmap(addr, len, prot, flag, fd, offset);
if (ptr == MAP_FAILED) {
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
return ptr;
}

void Munmap(void* addr, size_t len, const char* func) {
if (munmap(addr, len) == -1) {
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
}

void Ftruncate(int fd, off_t length, const char* func) {
if (ftruncate(fd, length) == -1) {
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
}

void Fclose(int fd, const char* func) {
if (close(fd) == -1) {
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
}

void SemInit(volatile sem_t* sem, int pshared, unsigned int value,
const char* func) {
if (sem_init((sem_t*) sem, pshared, value) == -1) {
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
}

void SemDestroy(volatile sem_t* sem, const char* func) {
if (sem_destroy((sem_t*) sem) == -1) {
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
}

void SemPost(volatile sem_t* sem, const char* func) {
if (sem_post((sem_t*) sem) == -1) {
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
}

Expand All @@ -86,15 +86,15 @@ int SemWait(volatile sem_t* sem, const char* func) {
if (errno == EINTR) {
return -1;
}
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
return 0;
}

int SemTryWait(volatile sem_t* sem, const char* func) {
int ret = sem_trywait((sem_t*) sem);
if (ret == -1 && errno != EAGAIN) {
ereport(ERROR, (errmsg("%s %s failed", func, __func__)));
ereport(ERROR, errmsg("%s %s failed", func, __func__));
}
return ret;
}
56 changes: 28 additions & 28 deletions src/kv_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static void GetForeignRelSize(PlannerInfo* root, RelOptInfo* baserel,
* can compute a better estimate of the average result row width.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

/*
* min & max will call GetForeignRelSize & GetForeignPaths multiple times,
Expand Down Expand Up @@ -162,7 +162,7 @@ static void GetForeignRelSize(PlannerInfo* root, RelOptInfo* baserel,
/* bit numbers are offset by FirstLowInvalidHeapAttributeNumber */
AttrNumber attr = col + FirstLowInvalidHeapAttributeNumber;
if (attr <= InvalidAttrNumber) { /* shouldn't happen */
ereport(ERROR, (errmsg("InvalidAttrNumber in %s", __func__)));
ereport(ERROR, errmsg("InvalidAttrNumber in %s", __func__));
}
planState->targetAttrs = lappend_int(planState->targetAttrs, attr);
printf(" %d ", attr);
Expand Down Expand Up @@ -204,7 +204,7 @@ static void GetForeignPaths(PlannerInfo* root, RelOptInfo* baserel,
* that is needed to identify the specific scan method intended.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

Cost startupCost = 0;
Cost totalCost = startupCost + baserel->rows;
Expand Down Expand Up @@ -238,7 +238,7 @@ static ForeignScan* GetForeignPlan(PlannerInfo* root, RelOptInfo* baserel,
*
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

/*
* We have no native ability to evaluate restriction clauses, so we just
Expand Down Expand Up @@ -309,7 +309,7 @@ static void GetKeyBasedQual(Node* node, ForeignScanState* scanState,
/* get the name of the operator according to PG_OPERATOR OID */
HeapTuple opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(op->opno));
if (!HeapTupleIsValid(opertup)) {
ereport(ERROR, (errmsg("cache lookup failed for operator %u", op->opno)));
ereport(ERROR, errmsg("cache lookup failed for operator %u", op->opno));
}
Form_pg_operator operform = (Form_pg_operator) GETSTRUCT(opertup);
char* oprname = NameStr(operform->oprname);
Expand Down Expand Up @@ -367,7 +367,7 @@ static void BeginForeignScan(ForeignScanState* scanState, int executorFlags) {
*
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

TableReadState* readState = palloc0(sizeof(TableReadState));
readState->execExplainOnly = false;
Expand Down Expand Up @@ -611,7 +611,7 @@ static TupleTableSlot* IterateForeignScan(ForeignScanState* scanState) {
* (just as you would need to do in the case of a data type mismatch).
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

TupleTableSlot* tupleSlot = scanState->ss.ss_ScanTupleSlot;
ExecClearTuple(tupleSlot);
Expand Down Expand Up @@ -666,7 +666,7 @@ static void ReScanForeignScan(ForeignScanState* scanState) {
* return exactly the same rows.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));
}

static void EndForeignScan(ForeignScanState* scanState) {
Expand All @@ -677,7 +677,7 @@ static void EndForeignScan(ForeignScanState* scanState) {
* remote servers should be cleaned up.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

TableReadState* readState = (TableReadState*) scanState->fdw_state;
Assert(readState);
Expand Down Expand Up @@ -748,7 +748,7 @@ static void AddForeignUpdateTargets(Query* parsetree, RangeTblEntry* tableEntry,
* relies on an unchanging primary key to identify rows.)
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

/*
* We are using first column as row identification column, so we are adding
Expand Down Expand Up @@ -792,7 +792,7 @@ static List* PlanForeignModify(PlannerInfo* root, ModifyTable* plan,
* BeginForeignModify will be NIL.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

#ifdef VIDARDB
if (plan->operation == CMD_INSERT) {
Expand Down Expand Up @@ -829,11 +829,11 @@ static List* PlanForeignModify(PlannerInfo* root, ModifyTable* plan,
while ((col = bms_first_member(attrs)) >= 0) {
col += FirstLowInvalidHeapAttributeNumber;
if (col <= InvalidAttrNumber) { /* shouldn't happen */
ereport(ERROR, (errmsg("InvalidAttrNumber in %s", __func__)));
ereport(ERROR, errmsg("InvalidAttrNumber in %s", __func__));
}
if (col == 1) {
ereport(ERROR, (errmsg("row identifier column update is "
"not supported.")));
ereport(ERROR, errmsg("row identifier column update is "
"not supported."));
}
if (col > 1) {
break;
Expand Down Expand Up @@ -878,7 +878,7 @@ static void BeginForeignModify(ModifyTableState* modifyTableState,
* during executor startup.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

if (executorFlags & EXEC_FLAG_EXPLAIN_ONLY) {
return;
Expand Down Expand Up @@ -929,7 +929,7 @@ static void SerializeTuple(StringInfo key, StringInfo val,
Datum datum = tupleSlot->tts_values[index];
if (tupleSlot->tts_isnull[index]) {
if (index == 0) {
ereport(ERROR, (errmsg("first column cannot be null!")));
ereport(ERROR, errmsg("first column cannot be null!"));
}

SerializeNullAttribute(tupleDescriptor, index, val);
Expand Down Expand Up @@ -971,7 +971,7 @@ static TupleTableSlot* ExecForeignInsert(EState* executorState,
* the foreign table will fail with an error message.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

TupleDesc tupleDescriptor = slot->tts_tupleDescriptor;

Expand Down Expand Up @@ -1040,7 +1040,7 @@ static TupleTableSlot* ExecForeignUpdate(EState* executorState,
*
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

TupleDesc tupleDescriptor = slot->tts_tupleDescriptor;
bool shouldFree;
Expand Down Expand Up @@ -1105,7 +1105,7 @@ static TupleTableSlot* ExecForeignDelete(EState* executorState,
* from the foreign table will fail with an error message.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

slot_getallattrs(planSlot);

Expand Down Expand Up @@ -1167,7 +1167,7 @@ static void EndForeignModify(EState* executorState, ResultRelInfo* resultRelInfo
* executor shutdown.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

TableWriteState* writeState = (TableWriteState*) resultRelInfo->ri_FdwState;

Expand Down Expand Up @@ -1201,7 +1201,7 @@ static void ExplainForeignScan(ForeignScanState* scanState,
* information is printed during EXPLAIN.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));
}

static void ExplainForeignModify(ModifyTableState* modifyTableState,
Expand All @@ -1221,7 +1221,7 @@ static void ExplainForeignModify(ModifyTableState* modifyTableState,
* information is printed during EXPLAIN.
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));
}

static bool AnalyzeForeignTable(Relation relation,
Expand Down Expand Up @@ -1255,7 +1255,7 @@ static bool AnalyzeForeignTable(Relation relation,
* ----
*/

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

return false;
}
Expand All @@ -1264,7 +1264,7 @@ Datum kv_fdw_handler(PG_FUNCTION_ARGS) {
printf("\n-----------------%s----------------------\n", __func__);
FdwRoutine* routine = makeNode(FdwRoutine);

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

/*
* assign the handlers for the FDW
Expand Down Expand Up @@ -1308,16 +1308,16 @@ Datum kv_fdw_validator(PG_FUNCTION_ARGS) {
printf("\n-----------------%s----------------------\n", __func__);
//List *options_list = untransformRelOptions(PG_GETARG_DATUM(0));

ereport(DEBUG1, (errmsg("entering function %s", __func__)));
ereport(DEBUG1, errmsg("entering function %s", __func__));

/* make sure the options are valid */

/* no options are supported */

/*if (list_length(options_list) > 0) {
ereport(ERROR, (errcode(ERRCODE_FDW_INVALID_OPTION_NAME),
errmsg("invalid options"),
errhint("FDW does not support any options")));
ereport(ERROR, errcode(ERRCODE_FDW_INVALID_OPTION_NAME),
errmsg("invalid options"),
errhint("FDW does not support any options"));
}*/

PG_RETURN_VOID();
Expand Down
Loading

0 comments on commit 9d97e5a

Please sign in to comment.