From 94da7e88b49db336c1db9c084134813f27c3eb2f Mon Sep 17 00:00:00 2001 From: mu <59917266+4eUeP@users.noreply.github.com> Date: Fri, 17 May 2024 14:05:45 +0800 Subject: [PATCH] updates --- .../Store/Internal/LogDevice/LogAttributes.hs | 12 ++++++------ hstream-store/cbits/logdevice/hs_log_attributes.cpp | 12 +++++------- hstream-store/test/HStream/Store/LogDeviceSpec.hs | 4 ++-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/hstream-store/HStream/Store/Internal/LogDevice/LogAttributes.hs b/hstream-store/HStream/Store/Internal/LogDevice/LogAttributes.hs index 179de77cc..e3d81e562 100644 --- a/hstream-store/HStream/Store/Internal/LogDevice/LogAttributes.hs +++ b/hstream-store/HStream/Store/Internal/LogDevice/LogAttributes.hs @@ -200,9 +200,9 @@ peekLogAttributes ptr = do runPeek NodeLocationScope $ \_ARG(syncReplicationScope) -> runPeekMaybeListPair replicateAcross_size $ \_MAYBE_LIST_PAIR(replicateAcross) -> runPeekMaybe id $ \_MAYBE_ARG(backlogDuration) -> - runPeek cbool2bool $ \_ARG(logScdEnabled) -> - runPeek cbool2bool $ \_ARG(logLocalScdEnabled) -> - runPeek cbool2bool $ \_ARG(logStickyCopySets) -> + runPeek cbool2bool $ \_ARG(scdEnabled) -> + runPeek cbool2bool $ \_ARG(localScdEnabled) -> + runPeek cbool2bool $ \_ARG(stickyCopySets) -> peek_log_attributes ptr _ARG(replicationFactor) @@ -212,9 +212,9 @@ peekLogAttributes ptr = do _ARG(syncReplicationScope) _MAYBE_LIST_PAIR(replicateAcross) _MAYBE_ARG(backlogDuration) - _ARG(logScdEnabled) - _ARG(logLocalScdEnabled) - _ARG(logStickyCopySets) + _ARG(scdEnabled) + _ARG(localScdEnabled) + _ARG(stickyCopySets) logAttrsExtras <- peekLogAttributesExtras ptr return LogAttributes{..} #undef _ARG diff --git a/hstream-store/cbits/logdevice/hs_log_attributes.cpp b/hstream-store/cbits/logdevice/hs_log_attributes.cpp index 7a1dbc9ba..bfe2ffd5d 100644 --- a/hstream-store/cbits/logdevice/hs_log_attributes.cpp +++ b/hstream-store/cbits/logdevice/hs_log_attributes.cpp @@ -17,9 +17,8 @@ poke_log_attributes(_ARG(int, replicationFactor), _ARG(int, syncedCopies), syncReplicationScope), _LIST_PAIR(replicateAcross, facebook::logdevice::NodeLocationScope, HsInt), - _MAYBE_ARG(int, backlogDuration), - _ARG(bool, scdEnabled), _ARG(bool, localScdEnabled), - _ARG(bool, stickyCopySets), + _MAYBE_ARG(int, backlogDuration), _ARG(bool, scdEnabled), + _ARG(bool, localScdEnabled), _ARG(bool, stickyCopySets), // HsInt extras_len, StgArrBytes** keys, StgArrBytes** vals) { #undef _ARG @@ -84,9 +83,8 @@ void peek_log_attributes( ARG(facebook::logdevice::NodeLocationScope, syncReplicationScope), ARG_LIST_PAIR(replicateAcross, facebook::logdevice::NodeLocationScope, HsInt), - ARG_MAYBE(HsInt, backlogDuration), - ARG(bool, scdEnabled), ARG(bool, localScdEnabled), - ARG(bool, stickyCopySets)) + ARG_MAYBE(HsInt, backlogDuration), ARG(bool, scdEnabled), + ARG(bool, localScdEnabled), ARG(bool, stickyCopySets)) #undef ARG #undef ARG_MAYBE #undef ARG_LIST_PAIR @@ -111,7 +109,7 @@ void peek_log_attributes( *name##_inh = attrs->name().isInherited(); \ if (name##_len > 0 && attrs->name().hasValue()) { \ auto& val = attrs->name().value(); \ - for (int i = 0; i < name##_len; i++) { \ + for (int i = 0; i < name##_len; i++) { \ name##_keys[i] = val[i].first; \ name##_vals[i] = val[i].second; \ } \ diff --git a/hstream-store/test/HStream/Store/LogDeviceSpec.hs b/hstream-store/test/HStream/Store/LogDeviceSpec.hs index a18b6001f..77a5ecdd7 100644 --- a/hstream-store/test/HStream/Store/LogDeviceSpec.hs +++ b/hstream-store/test/HStream/Store/LogDeviceSpec.hs @@ -18,10 +18,10 @@ logdirSpec :: Spec logdirSpec = describe "LogDirectory" $ do let attrs = S.def{ I.logReplicationFactor = I.defAttr1 1 , I.logBacklogDuration = I.defAttr1 (Just 60) - , I.logAttrsExtras = Map.fromList [("A", "B")] , I.logScdEnabled = I.defAttr1 False , I.logLocalScdEnabled = I.defAttr1 True , I.logStickyCopySets = I.defAttr1 False + , I.logAttrsExtras = Map.fromList [("A", "B")] } it "get log directory children name" $ do @@ -97,10 +97,10 @@ loggroupAround' = let attrs = S.def{ I.logReplicationFactor = I.defAttr1 1 , I.logBacklogDuration = I.defAttr1 (Just 60) , I.logSingleWriter = I.defAttr1 True + , I.logSyncReplicationScope = I.defAttr1 S.NodeLocationScope_DATA_CENTER , I.logScdEnabled = I.defAttr1 False , I.logLocalScdEnabled = I.defAttr1 True , I.logStickyCopySets = I.defAttr1 False - , I.logSyncReplicationScope = I.defAttr1 S.NodeLocationScope_DATA_CENTER , I.logAttrsExtras = Map.fromList [("A", "B")] } logid = 105