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

fix(connector): add fixed-connector-image options #1752

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions conf/hstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ hserver:
# so the tasks-network should be the network that can connect to HStreamDB and external systems.
tasks-network: host
extra-docker-args: "-m 4g"

# when restarting a connector, whether use fixed connector image(if images of config file was updated),
# true -> read image from metastore
# false -> read image from config file
fixed-connector-image: true

# source images
source-images:
mysql: hstreamdb/source-mysql:latest
Expand Down
11 changes: 6 additions & 5 deletions hstream-io/HStream/IO/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ data IOTaskStatus
deriving (Show, Eq, Generic, J.FromJSON, J.ToJSON)

data IOOptions = IOOptions
{ optTasksNetwork :: T.Text
, optTasksPath :: T.Text
, optSourceImages :: HM.HashMap T.Text T.Text
, optSinkImages :: HM.HashMap T.Text T.Text
, optExtraDockerArgs :: T.Text
{ optTasksNetwork :: T.Text
, optTasksPath :: T.Text
, optSourceImages :: HM.HashMap T.Text T.Text
, optSinkImages :: HM.HashMap T.Text T.Text
, optExtraDockerArgs :: T.Text
, optFixedConnectorImage :: Bool
} deriving (Show, Eq)

type TaskProcess = TP.Process IO.Handle IO.Handle ()
Expand Down
6 changes: 5 additions & 1 deletion hstream-io/HStream/IO/Worker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ recoverTask worker@Worker{..} name = do
Nothing -> throwIO $ HE.ConnectorNotFound name
Just (taskId, TaskMeta{taskInfoMeta=taskInfo@TaskInfo{..}}) -> do
let newConnCfg = J.insert "hstream" (J.toJSON hsConfig) connectorConfig
createIOTaskFromTaskInfo worker taskId taskInfo{connectorConfig=newConnCfg} options True False False
newImage = if options.optFixedConnectorImage
then taskConfig.tcImage
else makeImage taskType taskTarget options
newTaskConfig = taskConfig{tcImage=newImage}
createIOTaskFromTaskInfo worker taskId taskInfo{connectorConfig=newConnCfg, taskConfig=newTaskConfig} options True False False
s12f marked this conversation as resolved.
Show resolved Hide resolved

-- update config and restart
alterConnectorConfig :: Worker -> T.Text -> T.Text -> IO ()
Expand Down
1 change: 1 addition & 0 deletions hstream/src/HStream/Server/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ parseJSONToOptions CliOptions{..} obj = do
nodeSourceImages <- nodeIOCfg .:? "source-images" .!= HM.empty
nodeSinkImages <- nodeIOCfg .:? "sink-images" .!= HM.empty
optExtraDockerArgs <- nodeIOCfg .:? "extra-docker-args" .!= ""
optFixedConnectorImage <- nodeIOCfg .:? "fixed-connector-image" .!= True
(optSourceImages, optSinkImages) <- foldrM
(\img (ss, sk) -> do
-- "source mysql IMAGE" -> ("source" "mysq" "IMAGE")
Expand Down
Loading