mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +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 || {
|
||||
loop {
|
||||
if let Some((zk, id, watchers)) = &mut clusterized {
|
||||
log::info!("Waiting for an event to happen as a follower");
|
||||
// We're a follower
|
||||
// TODO: TAMO: the watchers never changes, that's not normal
|
||||
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 {
|
||||
// The person we were following died, we must see if we're the new leader
|
||||
let (mut childrens, _) = zk.get_children("/election").unwrap();
|
||||
@ -580,7 +583,8 @@ impl IndexScheduler {
|
||||
.create(
|
||||
"/snapshots/snapshot-",
|
||||
&[],
|
||||
&CreateMode::Persistent.with_acls(Acls::anyone_all()),
|
||||
&CreateMode::PersistentSequential
|
||||
.with_acls(Acls::anyone_all()),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@ -1457,7 +1461,7 @@ impl IndexSchedulerInner {
|
||||
match zookeeper.create(
|
||||
"/tasks/task-",
|
||||
&[],
|
||||
&CreateMode::Persistent.with_acls(Acls::anyone_all()),
|
||||
&CreateMode::PersistentSequential.with_acls(Acls::anyone_all()),
|
||||
) {
|
||||
Ok((_, id)) => Some(id),
|
||||
Err(e) => panic!("{e}"),
|
||||
|
Loading…
Reference in New Issue
Block a user