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

Add migration tools for function #80

Merged
merged 21 commits into from
Apr 30, 2021

Conversation

tuteng
Copy link
Member

@tuteng tuteng commented Feb 1, 2021

Fixed #77

  • Add migration tools for function

Mapped field

puslar     function-mesh
tenant <=> tenant
namespace <=> namespace
name <=> name
className <=> className
autoAck <=> autoAck
processingGuarantees <=> ProcessingGuarantee
retainOrdering <=> retainOrdering
retainKeyOrdering <=> RetainKeyOrdering
deadLetterTopic <=> DeadLetterTopic
forwardSourceMessageProperty <=> ForwardSourceMessageProperty
maxMessageRetries <=> MaxMessageRetry
parallelism <=> replicas, MaxReplicas
inputs <=> topics list
topicsPattern <=> TopicPattern
customSerdeInputs <=> CustomSerdeSources
customSchemaInputs <=> CustomSchemaSources
inputSpecs <=> sourceSpecs
   schemaType <=> schemaType
   SerdeClassName <=> SerdeClassName
   isRegexPattern <=> isRegexPattern
   schemaProperties <=> SchemaProperties
   consumerProperties <=> ConsumerProperties
   receiverQueueSize <=> ReceiverQueueSize
   cryptoConfig <=> CryptoConfig
resources <=> resources(limits, requests)
   cpu <=> cpu
   ram <=> memory
cleanupSubscription <=> cleanupSubscription
Topic <=> topic
outputSerdeClassName <=> SinkSerdeClassName
outputSchemaType <=> SinkSchemaType
customSchemaOutputs <=> CustomSchemaSinks
producerConfig <=> ProducerConf
   maxPendingMessages <=> MaxPendingMessages
   maxPendingMessagesAcrossPartitions <=> MaxPendingMessagesAcrossPartitions
   useThreadLocalProducers <=> UseThreadLocalProducers
   cryptoConfig <=> CryptoConfig
subscriptionPosition <=> SubscriptionPosition
subName <=> SubscriptionName
userConfig  <=> funcConfig?
runtimeFlags <=> RuntimeFlags
runtime <=> Runtime
logTopic <=> LogTopic
? <=> SourceType
? <=> SinkType

@tuteng tuteng requested review from freeznet and nlu90 as code owners February 1, 2021 03:34
@tuteng tuteng marked this pull request as draft February 1, 2021 03:35
tools/migration.go Outdated Show resolved Hide resolved
tools/migration.go Outdated Show resolved Hide resolved
tools/migration.go Outdated Show resolved Hide resolved
@tuteng tuteng marked this pull request as ready for review April 8, 2021 07:27
@tuteng tuteng requested a review from Huanli-Meng April 8, 2021 07:56
Copy link
Contributor

@Huanli-Meng Huanli-Meng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave my comments

tools/README.md Outdated Show resolved Hide resolved
tools/README.md Outdated Show resolved Hide resolved
@tuteng tuteng self-assigned this Apr 15, 2021
@nlu90
Copy link
Contributor

nlu90 commented Apr 19, 2021

parallelism <=> replicas, MaxReplicas

parallelism should be mapping to replicas, not MaxReplicas

? <=> SourceType
? <=> SinkType

The SourceType and SinkType are shortcut for built-in connectors based on the doc here. Currently we don't have built-in connectors, so the migration tool might want to reference how pulsar handles such built-in connectors translating

@freeznet
Copy link
Member

freeznet commented Apr 20, 2021

parallelism <=> replicas, MaxReplicas

parallelism should be mapping to replicas, not MaxReplicas

? <=> SourceType
? <=> SinkType

The SourceType and SinkType are shortcut for built-in connectors based on the doc here. Currently we don't have built-in connectors, so the migration tool might want to reference how pulsar handles such built-in connectors translating

I think there are some misusage of SourceType and SinkType in operator controller.

According to pulsar's doc, when running builtin IO connectors, user can just use --source-type or --sink-type to refer a built-in connector's name, such as pulsar-admin sinks create --sink-type data-generator, which means it create a sink from built-in connector pulsar-io-data-generator.

But for function-mesh, it acts differently. SourceType and SinkType are the ClassName of message's schema.

Like in SinkSpec, we have SourceType and SinkType

SourceType string `json:"sourceType,omitempty"`
SinkType string `json:"sinkType,omitempty"`

SourceType is used to generate proto.SourceSpec

TypeClassName: sink.Spec.SourceType,

SinkType is used to generate proto.SinkSpec

TypeClassName: sink.Spec.SinkType,

I have created typeClassName in SourceSpec and SinkSpec #133, to avoid naming inconsistencies with the official Pulsar doc.

@tuteng tuteng force-pushed the feature/add-a-tool-for-migration-function branch from f5f0cf0 to 2855e60 Compare April 26, 2021 04:13
@tuteng
Copy link
Member Author

tuteng commented Apr 26, 2021

./bin/pulsar-admin functions get --name test-func --tenant public --namespace default
{
  "tenant": "public",
  "namespace": "default",
  "name": "test-func",
  "className": "org.apache.pulsar.functions.api.examples.ExclamationFunction",
  "inputSpecs": {
    "test_src": {
      "isRegexPattern": false,
      "schemaProperties": {},
      "consumerProperties": {}
    }
  },
  "output": "test_result",
  "producerConfig": {
    "useThreadLocalProducers": false,
    "batchBuilder": ""
  },
  "processingGuarantees": "ATLEAST_ONCE",
  "retainOrdering": false,
  "retainKeyOrdering": false,
  "forwardSourceMessageProperty": true,
  "userConfig": {
    "PublishTopic": "test_result"
  },
  "runtime": "JAVA",
  "autoAck": true,
  "parallelism": 1,
  "resources": {
    "cpu": 1.0,
    "ram": 1073741824,
    "disk": 10737418240
  },
  "cleanupSubscription": true
}

I don't think we can get the values of SourceType and SinkType with the above command.

So there are two possible ways to solve this problem

  1. after the yaml file is generated, the user manually configures the two values
  2. by other method, such as reading the values directly from some configuration file
    Anyway, at the now I think there are still some problems with the migration, such as correctness and reliability that need to be verified
    I suggest we create a separate epic to follow up on this issue
    https://github.com/streamnative/cloud-epics/issues/144

@tuteng tuteng merged commit 32e74b5 into master Apr 30, 2021
@tuteng tuteng deleted the feature/add-a-tool-for-migration-function branch April 30, 2021 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pulsar function migration tool
4 participants