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: recoverdata and log print #3545

Merged
merged 4 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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: 3 additions & 3 deletions tools/openmldb_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def RecoverPartition(executor, db, partitions, endpoint_status):
db=db, table_name=table_name, pid=pid, leader_endpoint=leader_endpoint))
status = executor.LoadTable(leader_endpoint, table_name, tid, pid)
if not status.OK():
log.error("load table failed. db {db} name {table_name} tid {tid} pid {pid} endpoint {leader_endpoint} msg {status.GetMsg()}".format(
db=db, table_name=table_name, tid=tid, pid=pid, leader_endpoint=leader_endpoint, status=status))
log.error("load table failed. db {db} name {table_name} tid {tid} pid {pid} endpoint {leader_endpoint} msg {status}".format(
db=db, table_name=table_name, tid=tid, pid=pid, leader_endpoint=leader_endpoint, status=status.GetMsg()))
vagetablechicken marked this conversation as resolved.
Show resolved Hide resolved
return Status(-1, "recover partition failed")
if not partitions[leader_pos].IsAlive():
status = executor.UpdateTableAlive(db, table_name, pid, leader_endpoint, "yes")
Expand Down Expand Up @@ -205,7 +205,7 @@ def RecoverData(executor):
return
for name in tables:
if not RecoverTable(executor, db, name).OK():
return
log.error(f"recover table failed. db {db} name {name}, check log for detail")
vagetablechicken marked this conversation as resolved.
Show resolved Hide resolved

def ChangeLeader(db, partition, src_endpoint, desc_endpoint, one_replica, restore = True):
log.info(
Expand Down
7 changes: 4 additions & 3 deletions tools/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def LoadTable(self, endpoint, name, tid, pid, sync = True):
cmd = list(self.tablet_base_cmd)
cmd.append("--endpoint=" + self.endpoint_map[endpoint])
cmd.append("--cmd=loadtable {} {} {} 0 8".format(name, tid, pid))
log.info(f"run {cmd}")
status, output = self.RunWithRetuncode(cmd)
time.sleep(1)
if status.OK() and output.find("LoadTable ok") != -1:
Expand All @@ -289,12 +290,12 @@ def LoadTable(self, endpoint, name, tid, pid, sync = True):
if table_stat == "kTableNormal":
return Status()
elif table_stat == "kTableLoading" or table_stat == "kTableUndefined":
log.info("table is loading... tid {tid} pid {pid}".format(tid, pid))
log.info(f"table is loading... tid {tid} pid {pid}")
else:
return Status(-1, "table stat is {table_stat}".format(table_stat))
return Status(-1, f"table stat is {table_stat}")
vagetablechicken marked this conversation as resolved.
Show resolved Hide resolved
time.sleep(2)

return Status(-1, "execute load table failed")
return Status(-1, f"execute load table failed, status {status.GetMsg()}, output {output}")

def GetLeaderFollowerOffset(self, endpoint, tid, pid):
cmd = list(self.tablet_base_cmd)
Expand Down