pxf icon indicating copy to clipboard operation
pxf copied to clipboard

Parse cluster.txt in C extension

Open djianwen-vmware opened this issue 1 year ago • 0 comments
trafficstars

PXF 7 will support multi-cluster feature and thus the C extension needs the functionality to know which PXF host and port to communicate with. This PR does the following:

  • Create a new folder extension-common to store C source and test files shared by fdw and external-table extensions
  • Create pxfconfigparser module under extension-common folder. It includes a header file, a source file and a test file.
  • Add Makefileand README.md to extension-common folder for compiling the tests.
  • Add pxf_deployment, pxf_cluster, pxf_service_group and pxf_host structs to extension-common/pxfconfigparser.h header file. Also add some macros in the file.
  • Add functions to extension-common/pxfconfigparser.c for parsing cluster.txt of default cluster into a pxf_deployment struct instance.
    • For now, there is only one PXF cluster: default.
    • For now, the PXF_HOME is passed in as a parameter for parsing cluster.txt. We will use custom GUC instead of parameter in function later.
  • Add cleanup function deployment_cleanup() to extension-common/pxfconfigparser.c to free up the memory used by pxf_deployment.
  • Add unit tests for the parser

Other changes:

  • Include the extension-common/pxfconfigparser.o in the Makefile of external-table and fdw.
  • Identify some places where the parser may be used and add comments there. Also include the header file there.
  • Add a fixture folder extension-common/test/resources and some *.txt files for testing purpose.

djianwen-vmware avatar May 07 '24 22:05 djianwen-vmware