WDCommandData* ipcCommand = lfirst(lc);
if (ipcCommand)
{
- if (ipcCommand->commandSource != COMMAND_SOURCE_IPC)
- continue;
if (ipcCommand->commandPacket.command_id == pkt->command_id)
+ {
+ ereport(DEBUG1,
+ (errmsg("packet %c with command ID %d is reply to the command %c",pkt->type, pkt->command_id,
+ ipcCommand->commandPacket.type)));
return ipcCommand;
+ }
}
}
return NULL;
if (clusterCommand->commandReplyFromCount >= clusterCommand->commandSendToCount)
{
if (pkt->type == WD_REJECT_MESSAGE || pkt->type == WD_ERROR_MESSAGE)
+ {
+ ereport(DEBUG1,
+ (errmsg("command %c with command id %d is finished with COMMAND_FINISHED_NODE_REJECTED",pkt->type, pkt->command_id)));
clusterCommand->commandStatus = COMMAND_FINISHED_NODE_REJECTED;
+ }
else
+ {
+ ereport(DEBUG1,
+ (errmsg("command %c with command id %d is finished with COMMAND_FINISHED_ALL_REPLIED",pkt->type, pkt->command_id)));
clusterCommand->commandStatus = COMMAND_FINISHED_ALL_REPLIED;
+ }
watchdog_state_machine(WD_EVENT_COMMAND_FINISHED, wdNode, pkt, clusterCommand);
+ g_cluster.clusterCommands = list_delete_ptr(g_cluster.clusterCommands,clusterCommand);
+ MemoryContextDelete(clusterCommand->memoryContext);
}
else if (pkt->type == WD_REJECT_MESSAGE || pkt->type == WD_ERROR_MESSAGE)
{
/* Error or reject message by any node imidiately finishes the command */
+ ereport(DEBUG1,
+ (errmsg("command %c with command id %d is finished with COMMAND_FINISHED_NODE_REJECTED",pkt->type, pkt->command_id)));
clusterCommand->commandStatus = COMMAND_FINISHED_NODE_REJECTED;
watchdog_state_machine(WD_EVENT_COMMAND_FINISHED, wdNode, pkt, clusterCommand);
+ g_cluster.clusterCommands = list_delete_ptr(g_cluster.clusterCommands,clusterCommand);
+ MemoryContextDelete(clusterCommand->memoryContext);
}
-
return true; /* do not process this packet further */
}
memcpy(clusterCommand->commandPacket.data,pkt->data,pkt->len);
clusterCommand->commandPacket.len = pkt->len;
}
+ ereport(DEBUG2,
+ (errmsg("new cluster command %c issued with command id %d",pkt->type,pkt->command_id)));
oldCxt = MemoryContextSwitchTo(TopMemoryContext);
g_cluster.clusterCommands = lappend(g_cluster.clusterCommands, clusterCommand);