Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Gossip DB fault tolerance #344

Merged
merged 28 commits into from
Oct 9, 2019

Conversation

sfxdxdev
Copy link
Contributor

@sfxdxdev sfxdxdev commented Oct 3, 2019

Commits whole DB after event connecting.
Detects DB-dirty flag on start.

gossip/store.go Outdated
// setDirty sets dirty flag.
func (s *Store) setDirty(flag bool) {
key := []byte("is_dirty")
val := make([]byte, 1, 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S1019: should use make([]byte, 1) instead (from gosimple)

if prevId == nil {
prevId = &mark
}
if bytes.Compare(mark, *prevId) != 0 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S1004: should use !bytes.Equal(mark, *prevId) instead (from gosimple)

@@ -188,7 +188,7 @@ func (p *Poset) ProcessEvent(e *inter.Event) (err error) {
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • remove defer func and move the commit to the end.
  • on err, add a debug log instead of quietly return.

gossip/store.go Outdated
s.Log.Crit("Failed to get value", "err", err)
}

return len(val) > 1 && val[0] != 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

len(val) > 0 && val[0] ==1

@@ -226,8 +257,11 @@ func (sdb *SuperDb) FlushIfNeeded(id hash.Event) bool {

// call on startup, after all dbs are registered
func (sdb *SuperDb) CheckDbsSynced() error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • add comment to the function.
  • Compare the flag values across barDbs?

key := []byte("flag")
var prevId *hash.Event
var prevId *[]byte
for _, db := range sdb.bareDbs {
mark, err := db.Get(key)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change mark to eventId

}

func (sdb *SuperDb) DropDb(name string) {
if db := sdb.bareDbs[name]; db == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add log

defer func() {
if err != nil {
return
}
err = p.store.Commit()
immediately := (p.EpochN != was)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ineffectual assignment to immediately (from ineffassign)

devintegral pushed a commit that referenced this pull request Oct 9, 2019
Merge pull request #344 from sfxdxdev/gossip-fault-tolerance
@devintegral devintegral merged commit 5c7ec30 into Fantom-foundation:scope2 Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants