-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge Add fragment Merge Merge Merge Merge Merge Merge Update test Merge Merge Merge Handle RedisLock correctly Remove mistakenly placed function Fix wrong logging Fix wrong type Fix CI Remove useless Raft RedisConnection Improve leader not found error handling Merge Update dependencies Update log_dir Rename LogLevel WIP RaftCluster -> RaftFacade WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP
- Loading branch information
1 parent
b31efcb
commit 3ec9b9a
Showing
23 changed files
with
1,214 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
raft-*.mdb | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add Raft-based leader election process to manager group in HA condition in order to make their states consistent. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
# Use current Shell as API Mode | ||
tmux rename-window API-Mode | ||
|
||
# Session Mode | ||
tmux new-window | ||
tmux rename-window Session-Mode | ||
|
||
# Manager | ||
tmux new-window | ||
tmux rename-window manager | ||
|
||
# Agent | ||
tmux new-window | ||
tmux rename-window agent | ||
|
||
# Storage | ||
tmux new-window | ||
tmux rename-window storage | ||
|
||
# Web UI | ||
tmux new-window | ||
tmux rename-window web | ||
|
||
sleep 2 | ||
|
||
tmux send-keys -t manager './backend.ai mgr start-server --debug' Enter | ||
tmux send-keys -t agent './backend.ai ag start-server --debug' Enter | ||
tmux send-keys -t storage './py -m ai.backend.storage.server' Enter | ||
tmux send-keys -t web './py -m ai.backend.web.server' Enter | ||
tmux send-keys -t API-Mode 'source env-local-admin-api.sh' Enter | ||
tmux send-keys -t Session-Mode 'source env-local-admin-session.sh' Enter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
import sys | ||
import lmdb | ||
import rraft | ||
from raftify.deserializer import init_rraft_py_deserializer | ||
from raftify.storage.lmdb import SNAPSHOT_KEY, LAST_INDEX_KEY, HARD_STATE_KEY, CONF_STATE_KEY | ||
|
||
|
||
def main(argv): | ||
init_rraft_py_deserializer() | ||
idx = argv[1] | ||
assert idx.isdigit(), "idx must be a number" | ||
|
||
env = lmdb.open(f"{os.getcwd()}/logs/node-{idx}", max_dbs=2) | ||
|
||
entries_db = env.open_db(b"entries") | ||
|
||
print('---- Entries ----') | ||
with env.begin(db=entries_db) as txn: | ||
cursor = txn.cursor() | ||
for key, value in cursor: | ||
print(f"Key: {int(key.decode())}, Value: {rraft.Entry.decode(value)}") | ||
|
||
metadata_db = env.open_db(b"meta") | ||
|
||
print('---- Metadata ----') | ||
with env.begin(db=metadata_db) as txn: | ||
cursor = txn.cursor() | ||
for key, value in cursor: | ||
if key == SNAPSHOT_KEY: | ||
print(f'Key: "snapshot", Value: "{rraft.Snapshot.decode(value)}"') | ||
elif key == LAST_INDEX_KEY: | ||
print(f'Key: "last_index", Value: "{int(value.decode())}"') | ||
elif key == HARD_STATE_KEY: | ||
print(f'Key: "hard_state", Value: "{rraft.HardState.decode(value)}"') | ||
elif key == CONF_STATE_KEY: | ||
print(f'Key: "conf_state", Value: "{rraft.ConfState.decode(value)}"') | ||
else: | ||
assert False, f"Unknown key: {key}" | ||
|
||
env.close() | ||
|
||
|
||
if __name__ == "__main__": | ||
main(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.