mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
WIP fix a lot of bugs: The follower do not wake up when a new snapshot is available
This commit is contained in:
parent
d0a3582a56
commit
c5ec817f52
@ -502,10 +502,13 @@ impl IndexScheduler {
|
|||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
loop {
|
loop {
|
||||||
if let Some((zk, id, watchers)) = &mut clusterized {
|
if let Some((zk, id, watchers)) = &mut clusterized {
|
||||||
|
log::info!("Waiting for an event to happen as a follower");
|
||||||
// We're a follower
|
// We're a follower
|
||||||
|
// TODO: TAMO: the watchers never changes, that's not normal
|
||||||
let event = watchers.changed();
|
let event = watchers.changed();
|
||||||
|
log::info!("Woke up, we got a new event at {}", event.path);
|
||||||
|
|
||||||
if event.path.starts_with("election") {
|
if event.path.starts_with("/election") {
|
||||||
if event.event_type == EventType::NodeDeleted {
|
if event.event_type == EventType::NodeDeleted {
|
||||||
// The person we were following died, we must see if we're the new leader
|
// The person we were following died, we must see if we're the new leader
|
||||||
let (mut childrens, _) = zk.get_children("/election").unwrap();
|
let (mut childrens, _) = zk.get_children("/election").unwrap();
|
||||||
@ -580,7 +583,8 @@ impl IndexScheduler {
|
|||||||
.create(
|
.create(
|
||||||
"/snapshots/snapshot-",
|
"/snapshots/snapshot-",
|
||||||
&[],
|
&[],
|
||||||
&CreateMode::Persistent.with_acls(Acls::anyone_all()),
|
&CreateMode::PersistentSequential
|
||||||
|
.with_acls(Acls::anyone_all()),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -1457,7 +1461,7 @@ impl IndexSchedulerInner {
|
|||||||
match zookeeper.create(
|
match zookeeper.create(
|
||||||
"/tasks/task-",
|
"/tasks/task-",
|
||||||
&[],
|
&[],
|
||||||
&CreateMode::Persistent.with_acls(Acls::anyone_all()),
|
&CreateMode::PersistentSequential.with_acls(Acls::anyone_all()),
|
||||||
) {
|
) {
|
||||||
Ok((_, id)) => Some(id),
|
Ok((_, id)) => Some(id),
|
||||||
Err(e) => panic!("{e}"),
|
Err(e) => panic!("{e}"),
|
||||||
|
Loading…
Reference in New Issue
Block a user