Reading pg_worker_list.conf on upgrade

pull/801/head
Brian Cloutier 2016-09-23 16:22:27 +03:00
parent 4ef57cb67a
commit ee83df8990
1 changed files with 16 additions and 20 deletions

View File

@ -145,31 +145,27 @@ cluster_remove_node(PG_FUNCTION_ARGS)
/* /*
* cluster_initialize_node_metadata is run once, when upgrading citus. It injests the
* existing pg_worker_list.conf into pg_dist_node, then adds a header to the file stating
* that it's no longer used.
*/ */
Datum Datum
cluster_initialize_node_metadata(PG_FUNCTION_ARGS) cluster_initialize_node_metadata(PG_FUNCTION_ARGS)
{ {
PG_RETURN_BOOL(true); ListCell *workerNodeCell = NULL;
List *workerNodes = ParseWorkerNodeFile("pg_worker_list.conf");
/* foreach(workerNodeCell, workerNodes)
* text *filePath = PG_GETARG_TEXT_P(0); {
* char *filePathCStr = text_to_cstring(filePath); WorkerNode *workerNode = (WorkerNode *) lfirst(workerNodeCell);
* Datum workerNameDatum = PointerGetDatum(cstring_to_text(workerNode->workerName));
* ListCell *workerNodeCell = NULL;
* List *workerNodes = ParseWorkerNodeFile(filePathCStr); DirectFunctionCall3(cluster_add_node, workerNameDatum,
* UInt32GetDatum(workerNode->workerPort),
* foreach(workerNodeCell, workerNodes) PointerGetDatum(NULL));
* { }
* WorkerNode *workerNode = (WorkerNode *) lfirst(workerNodeCell);
* Datum workerNameDatum = PointerGetDatum(cstring_to_text(workerNode->workerName)); PG_RETURN_BOOL(true);
*
* DirectFunctionCall3(cluster_add_node, workerNameDatum,
* UInt32GetDatum(workerNode->workerPort),
* PointerGetDatum(NULL));
* }
*
* PG_RETURN_BOOL(true);
*/
} }