Fix list creation

velioglu/wo_seq_test_1
Burak Velioglu 2021-12-17 14:06:34 +03:00
parent 3636b7c9c5
commit f66b1d5116
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
5 changed files with 16 additions and 35 deletions

View File

@ -392,7 +392,8 @@ ReplicateAllDependenciesToNode(const char *nodeName, int nodePort)
} }
/* since we are executing ddl commands lets disable propagation, primarily for mx */ /* since we are executing ddl commands lets disable propagation, primarily for mx */
ddlCommands = list_make3(DISABLE_DDL_PROPAGATION, ddlCommands, ENABLE_DDL_PROPAGATION); ddlCommands = lcons(DISABLE_DDL_PROPAGATION, ddlCommands);
ddlCommands = lappend(ddlCommands, ENABLE_DDL_PROPAGATION);
SendMetadataCommandListToWorkerInCoordinatedTransaction(nodeName, nodePort, CitusExtensionOwnerName(), ddlCommands); SendMetadataCommandListToWorkerInCoordinatedTransaction(nodeName, nodePort, CitusExtensionOwnerName(), ddlCommands);
} }

View File

@ -1459,6 +1459,8 @@ ShouldShutdownConnection(MultiConnection *connection, const int cachedConnection
bool bool
IsCitusInitiatedRemoteBackend(void) IsCitusInitiatedRemoteBackend(void)
{ {
elog(WARNING, "IsCitusInitiatedRemoteBackend");
elog(WARNING, "Application name is %s", application_name);
return application_name && strcmp(application_name, CITUS_APPLICATION_NAME) == 0; return application_name && strcmp(application_name, CITUS_APPLICATION_NAME) == 0;
} }

View File

@ -207,8 +207,6 @@ StartMetadataSyncToNode(const char *nodeNameString, int32 nodePort)
return; return;
} }
UseCoordinatedTransaction();
/* /*
* One would normally expect to set hasmetadata first, and then metadata sync. * One would normally expect to set hasmetadata first, and then metadata sync.
* However, at this point we do the order reverse. * However, at this point we do the order reverse.

View File

@ -650,11 +650,12 @@ SetUpMultipleDistributedTableIntegrations(WorkerNode *workerNode)
} }
char *currentUser = CurrentUserName(); char *currentUser = CurrentUserName();
List *commandList = list_make3(DISABLE_DDL_PROPAGATION, multipleTableIntegrationCommandList, ENABLE_DDL_PROPAGATION); multipleTableIntegrationCommandList = lcons(DISABLE_DDL_PROPAGATION, multipleTableIntegrationCommandList);
multipleTableIntegrationCommandList = lappend(multipleTableIntegrationCommandList, ENABLE_DDL_PROPAGATION);
SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName, SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName,
workerNode->workerPort, workerNode->workerPort,
currentUser, currentUser,
commandList); multipleTableIntegrationCommandList);
} }
@ -712,13 +713,14 @@ SetUpObjectMetadata(WorkerNode *workerNode)
distributedObjectSyncCommandList); distributedObjectSyncCommandList);
} }
List *metadataSnapshotCommands = list_make3(DISABLE_DDL_PROPAGATION, metadataSnapshotCommandList, ENABLE_DDL_PROPAGATION); metadataSnapshotCommandList = lcons(DISABLE_DDL_PROPAGATION, metadataSnapshotCommandList);
metadataSnapshotCommandList = lappend(metadataSnapshotCommandList, ENABLE_DDL_PROPAGATION);
char *currentUser = CurrentUserName(); char *currentUser = CurrentUserName();
SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName, SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName,
workerNode->workerPort, workerNode->workerPort,
currentUser, currentUser,
metadataSnapshotCommands); metadataSnapshotCommandList);
} }
@ -824,43 +826,19 @@ ClearDistributedObjectsWithMetadataFromNode(WorkerNode *workerNode)
clearDistTableInfoCommandList = list_concat(clearDistTableInfoCommandList, clearDistTableInfoCommandList = list_concat(clearDistTableInfoCommandList,
detachPartitionCommandList); detachPartitionCommandList);
/* iterate over the commands and execute them in the same connection */
const char *commandString = NULL;
foreach_ptr(commandString, clearDistTableInfoCommandList)
{
elog(WARNING, "Current command 1 is %s", commandString);
}
clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList, clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList,
REMOVE_ALL_CLUSTERED_TABLES_COMMAND); REMOVE_ALL_CLUSTERED_TABLES_COMMAND);
commandString = NULL;
foreach_ptr(commandString, clearDistTableInfoCommandList)
{
elog(WARNING, "Current command 2 is %s", commandString);
}
clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList, DELETE_ALL_DISTRIBUTED_OBJECTS); clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList, DELETE_ALL_DISTRIBUTED_OBJECTS);
commandString = NULL;
foreach_ptr(commandString, clearDistTableInfoCommandList)
{
elog(WARNING, "Current command 3 is %s", commandString);
}
clearDistTableInfoCommandList = list_concat(list_make1(DISABLE_DDL_PROPAGATION),clearDistTableInfoCommandList); clearDistTableInfoCommandList = list_concat(list_make1(DISABLE_DDL_PROPAGATION),clearDistTableInfoCommandList);
clearDistTableInfoCommandList = list_concat(clearDistTableInfoCommandList, list_make1(ENABLE_DDL_PROPAGATION)); clearDistTableInfoCommandList = list_concat(clearDistTableInfoCommandList, list_make1(ENABLE_DDL_PROPAGATION));
commandString = NULL;
foreach_ptr(commandString, clearDistTableInfoCommandList)
{
elog(WARNING, "Current command 3 is %s", commandString);
}
char *currentUser = CurrentUserName(); char *currentUser = CurrentUserName();
SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName, SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName,
workerNode->workerPort, workerNode->workerPort,
currentUser, currentUser,
clearDistTableCommands); clearDistTableInfoCommandList);
} }
@ -943,7 +921,8 @@ PropagateNodeWideObjects(WorkerNode *newWorkerNode)
if (list_length(ddlCommands) > 0) if (list_length(ddlCommands) > 0)
{ {
/* if there are command wrap them in enable_ddl_propagation off */ /* if there are command wrap them in enable_ddl_propagation off */
ddlCommands = list_make3(DISABLE_DDL_PROPAGATION, ddlCommands, ENABLE_DDL_PROPAGATION); ddlCommands = lcons(DISABLE_DDL_PROPAGATION, ddlCommands);
ddlCommands = lappend(ddlCommands, ENABLE_DDL_PROPAGATION);
/* send commands to new workers*/ /* send commands to new workers*/
SendMetadataCommandListToWorkerInCoordinatedTransaction(newWorkerNode->workerName, SendMetadataCommandListToWorkerInCoordinatedTransaction(newWorkerNode->workerName,
@ -1246,8 +1225,7 @@ DetachPartitionCommandList(void)
return NIL; return NIL;
} }
detachPartitionCommandList = detachPartitionCommandList = lcons(DISABLE_DDL_PROPAGATION, detachPartitionCommandList);
lcons(DISABLE_DDL_PROPAGATION, detachPartitionCommandList);
/* /*
* We probably do not need this but as an extra precaution, we are enabling * We probably do not need this but as an extra precaution, we are enabling

View File

@ -907,12 +907,14 @@ MyBackendGotCancelledDueToDeadlock(bool clearState)
bool bool
MyBackendIsInDisributedTransaction(void) MyBackendIsInDisributedTransaction(void)
{ {
elog(WARNING, "MyBackendIsInDisributedTransaction 1");
/* backend might not have used citus yet and thus not initialized backend data */ /* backend might not have used citus yet and thus not initialized backend data */
if (!MyBackendData) if (!MyBackendData)
{ {
return false; return false;
} }
elog(WARNING, "MyBackendIsInDisributedTransaction 2");
return IsInDistributedTransaction(MyBackendData); return IsInDistributedTransaction(MyBackendData);
} }