Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure remote logging in GenericUdfCallHandler #175

Open
kaklakariada opened this issue Nov 15, 2023 · 0 comments
Open

Configure remote logging in GenericUdfCallHandler #175

kaklakariada opened this issue Nov 15, 2023 · 0 comments
Assignees
Labels
feature Product feature

Comments

@kaklakariada
Copy link
Collaborator

kaklakariada commented Nov 15, 2023

Remote logging allows reading log messages from the virtual schema. This however only works for the adapter, not the loader class GenericUdfCallHandler (called byUdfEntryPoint in IMPORT_FROM_S3_DOCUMENT_FILES for the S3 VS).

Root cause is that GenericUdfCallHandler does not configure logging similar to RequestDispatcher in virtual-schema-common-java.

To make this work we need to pass the logging configuration (i.e. host, port and log level) to the importer via UDF parameters.

Note: UDF parameters are hard coded in the SCRIPT definitions of the virtual schemas, e.g.

CREATE OR REPLACE JAVA SET SCRIPT ADAPTER.IMPORT_FROM_S3_DOCUMENT_FILES(
  DATA_LOADER VARCHAR(2000000),
  SCHEMA_MAPPING_REQUEST VARCHAR(2000000),
  CONNECTION_NAME VARCHAR(500))
  EMITS(...) AS
    %scriptclass com.exasol.adapter.document.UdfEntryPoint;
    %jar /buckets/bfsdefault/default/document-files-virtual-schema-dist-7.3.7-s3-2.8.4.jar;
/

While we could add an additional parameter for the logging config, this is not a future proof solution. It would be better to use a single generic parameter that contains all necessary values serialized as JSON or Java objects. This is a breaking change because users need to update their SCRIPT definitions.

Proposal for new SCRIPT definitions:

CREATE OR REPLACE JAVA SET SCRIPT ADAPTER.IMPORT_FROM_S3_DOCUMENT_FILES(
  SERIALIZED_PARAMETERS VARCHAR(2000000))
  EMITS(...) AS
    %scriptclass com.exasol.adapter.document.UdfEntryPoint;
    %jar /buckets/bfsdefault/default/document-files-virtual-schema-dist-7.3.7-s3-2.8.4.jar;
/

Advantage: we can add additional parameter values at any time without breaking the interface.

Disadvantage: breaking change for VS users, because the parameters in the SET SCRIPT adapter definition change.

Required changes:

  • Update GenericUdfCallHandler to expect a single parameter and extract values from it
  • Update UdfCallBuilder to serialize all parameters into a single string and add it to the pushdown query
  • Update SCRIPT definitions in all user guides of all document based virtual schemas to use the new parameter
  • Increment major version of all affected projects as this is a breaking change.
@kaklakariada kaklakariada added the feature Product feature label Nov 15, 2023
@kaklakariada kaklakariada self-assigned this Nov 17, 2023
kaklakariada added a commit that referenced this issue Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Product feature
Projects
None yet
Development

No branches or pull requests

1 participant