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

kafka workarounds: make the size of replicaNodes equal to the replicationFactor #1798

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
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: 5 additions & 1 deletion hstream-kafka/HStream/Kafka/Server/Handler/Basic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Data.Functor ((<&>))
import Data.Int (Int32)
import qualified Data.List as L
import qualified Data.Map as Map
import Data.Maybe (fromJust)
import qualified Data.Set as S
import Data.Text (Text)
import qualified Data.Text as Text
Expand Down Expand Up @@ -222,11 +223,14 @@ handleMetadata ctx reqCtx req = do
<> " is too large, it should be less than "
<> Log.build (maxBound :: Int32)
let (theNodeId :: Int32) = fromIntegral (A.serverNodeId theNode)
streamId = S.transToTopicStreamName topicName
-- The logReplicationFactor should not be Nothing, so we use fromJust here.
repfac <- fromJust . S.attrValue . S.logReplicationFactor <$> S.getStreamLogAttrs ctx.scLDClient streamId
pure $ K.MetadataResponsePartition
{ errorCode = K.NONE
, partitionIndex = (fromIntegral idx)
, leaderId = theNodeId
, replicaNodes = K.KaArray $ Just (V.singleton theNodeId) -- FIXME: what should it be?
, replicaNodes = K.NonNullKaArray $ (V.replicate repfac theNodeId) -- FIXME: what should it be?
, isrNodes = K.KaArray $ Just (V.singleton theNodeId) -- FIXME: what should it be?
, offlineReplicas = K.KaArray $ Just V.empty -- TODO
}
Expand Down
Loading