skydive-project / skydive

An open source real-time network topology and protocols analyzer
https://skydive.network
Apache License 2.0
2.68k stars 404 forks source link

Archive 002 producing errors on restart #2404

Closed adrianlzt closed 3 years ago

adrianlzt commented 3 years ago

Using a elasticsearch as backend, with index_entries_limit: 10.

If we create 8 nodes and then update all of them we will have 8 docs in live index and 8 in archive 001.

Now we update again the 8 nodes, now we have 16 docs in archive 001.

When the roll index kick in, it will generate the archive 002 and point the archive alias to that 002 index.

If we restart skydive at this point, it will consider archive 002 as an old index (3f7102dfdd54781650bfe610a7edbbd20d75ec52) and move the alias back to archive 001.

This is already a problem, but also, ni the next roll index, it will try to create again archive 002, failing because it already exists.

I want to understand why the commit 3f7102dfdd54781650bfe610a7edbbd20d75ec52 remove old indices before trying to fix it (because the fix looks like its almost reverting that commit).

safchain commented 3 years ago

Hello, I can't find the commit you specified

adrianlzt commented 3 years ago

Uops, I copied the bad string

lebauce commented 3 years ago

@adrianlzt It seems that the commit tried to fix this problem : https://github.com/skydive-project/skydive/issues/2334 Maybe the fix could be to simply change if previousIndex != indexName { to if !strings.HasPrefix(previousIndex, c.Config.IndexPrefix+i.Name + "_v" + schemaVersion {