Skip to content

Commit

Permalink
Handle the PR review comments
Browse files Browse the repository at this point in the history
* Follow clojure's style rules
* Get rid of sleep calls and use gen/stagger instead
* Track Hazelcast clients name between test clients and models via an atom map
* Simplify the repeat script
* No logging in models
* Simplify logging and Jepsen op result creation in CP test clients
* Other minor improvements based on the PR review comments

Co-authored-by: Mehmet Dogan <[email protected]>
Co-authored-by: Ensar Basri Kahveci <[email protected]>
  • Loading branch information
3 people committed Mar 4, 2019
1 parent 9b78798 commit 6b2d9ef
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 310 deletions.
18 changes: 1 addition & 17 deletions hazelcast/repeat_single_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,5 @@ fi
test_name=$1
repeat=$2
test_duration=$3
round="1"

while [ ${round} -le ${repeat} ]; do

echo "round: $round"

echo "running $test_name test"

lein run test --workload ${test_name} --time-limit ${test_duration}

if [ $? != '0' ]; then
echo "$test_name test failed"
exit 1
fi

round=`expr $round \+ 1`

done
lein run test --workload ${test_name} --test-count ${repeat} --time-limit ${test_duration}
30 changes: 14 additions & 16 deletions hazelcast/server/src/jepsen/hazelcast_server.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,28 @@
:parse-fn (fn [m]
(str/split m #"\s*,\s*"))]])

(defn prepareCPSubsystemConfig
(defn prepare-cp-subsystem-config
"Prepare Hazelcast CPSubsystemConfig"
[config members]
(let [cpSubsystemConfig (.getCPSubsystemConfig config)
raftAlgorithmConfig (.getRaftAlgorithmConfig cpSubsystemConfig)
semaphoreConfig (CPSemaphoreConfig. "jepsen.cpSemaphore" false)
lockConfig1 (FencedLockConfig. "jepsen.cpLock1" 1)
lockConfig2 (FencedLockConfig. "jepsen.cpLock2" 2)
lockConfig2 (FencedLockConfig. "jepsen.cpLock2" 2)]

_ (.setLeaderElectionTimeoutInMillis raftAlgorithmConfig 1000)
_ (.setLeaderHeartbeatPeriodInMillis raftAlgorithmConfig 1500)
_ (.setCommitIndexAdvanceCountToSnapshot raftAlgorithmConfig 250)
_ (.setFailOnIndeterminateOperationState cpSubsystemConfig true)
(.setLeaderElectionTimeoutInMillis raftAlgorithmConfig 1000)
(.setLeaderHeartbeatPeriodInMillis raftAlgorithmConfig 1500)
(.setCommitIndexAdvanceCountToSnapshot raftAlgorithmConfig 250)
(.setFailOnIndeterminateOperationState cpSubsystemConfig true)

_ (.setCPMemberCount cpSubsystemConfig (count members))
_ (.setSessionHeartbeatIntervalSeconds cpSubsystemConfig 5)
_ (.setSessionTimeToLiveSeconds cpSubsystemConfig 300)
(.setCPMemberCount cpSubsystemConfig (count members))
(.setSessionHeartbeatIntervalSeconds cpSubsystemConfig 5)
(.setSessionTimeToLiveSeconds cpSubsystemConfig 300)

_ (.addSemaphoreConfig cpSubsystemConfig semaphoreConfig)
_ (.addLockConfig cpSubsystemConfig lockConfig1)
_ (.addLockConfig cpSubsystemConfig lockConfig2)

]
cpSubsystemConfig))
(.addSemaphoreConfig cpSubsystemConfig semaphoreConfig)
(.addLockConfig cpSubsystemConfig lockConfig1)
(.addLockConfig cpSubsystemConfig lockConfig2)
cpSubsystemConfig))

(defn -main
"Go go go"
Expand Down Expand Up @@ -70,7 +68,7 @@
_ (.setEnabled tcp-ip true)

; prepare the CP subsystem
_ (prepareCPSubsystemConfig config members)
_ (prepare-cp-subsystem-config config members)

; Quorum for split-brain protection
quorum (doto (QuorumConfig.)
Expand Down
Loading

0 comments on commit 6b2d9ef

Please sign in to comment.