Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Conversation

@patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Jan 6, 2022

https://docs.google.com/document/d/1kK6J0BkogmUuwr47pseNPN5YPWtA-WSx40LhLQRa27k/edit

t=2022-01-06T00:09:20-0800 lvl=dbug msg="prefix expired" prefix=foo
t=2022-01-06T00:09:20-0800 lvl=dbug msg="prefix expired" prefix=foo
t=2022-01-06T00:09:20-0800 lvl=dbug msg="prefix expired" prefix=foo
t=2022-01-06T00:09:20-0800 lvl=dbug msg="rprefix pruned" rprefix=e6f0014586d469e2a11f494a93cabdab0f69f612
t=2022-01-06T00:09:20-0800 lvl=dbug msg="rprefix pruned" rprefix=1900832420acc0fed9673c86e45a3ce325b280a8
t=2022-01-06T00:09:20-0800 lvl=dbug msg="rprefix pruned" rprefix=c13e3f783aec2c16df329fc6780871d2e27aed43

@patrick-ogrady patrick-ogrady marked this pull request as draft January 6, 2022 05:00
}
if !exists {
return ErrPrefixMissing
}
Copy link
Contributor Author

@patrick-ogrady patrick-ogrady Jan 6, 2022

Choose a reason for hiding this comment

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

nit: \n

}
if !exists {
return ErrPrefixMissing
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: \n

}
if !exists {
return nil, ErrPrefixMissing
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: \n

@patrick-ogrady patrick-ogrady force-pushed the state-expiry branch 2 times, most recently from fb506fe to ada6ee8 Compare January 6, 2022 08:32
@patrick-ogrady patrick-ogrady changed the title State expiry State expiry + Pruning Jan 6, 2022
@patrick-ogrady patrick-ogrady changed the title State expiry + Pruning State Expiry + Online Pruning Jan 6, 2022
@patrick-ogrady patrick-ogrady requested a review from gyuho January 6, 2022 09:16
Copy link
Contributor

@gyuho gyuho left a comment

Choose a reason for hiding this comment

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

lgtm, added some docs

}

k = make([]byte, n)
// Assumes [prefix] and [key] do not contain delimiter
Copy link
Contributor

Choose a reason for hiding this comment

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

nice simplification :)

key: []byte("hello"),
opts: []OpOption{WithPrefix()},
kvs: []KeyValue{
{Key: []byte("foo/hello00000"), Value: []byte("bar00000")},
Copy link
Contributor

Choose a reason for hiding this comment

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

nice :)

vm.stopc = make(chan struct{})
vm.donecRun = make(chan struct{})
vm.donecRegossip = make(chan struct{})
vm.donecPrune = make(chan struct{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this being used for wait for prune done?

Copy link
Contributor

Choose a reason for hiding this comment

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

Added wait on this channel in shutdown.

kvs, err := instances[0].cli.Range(pfx, k)
gomega.Ω(err).To(gomega.BeNil())
gomega.Ω(kvs[0].Key).To(gomega.Equal(append(append(pfx, parser.Delimiter), k...)))
gomega.Ω(kvs[0].Key).To(gomega.Equal(k))
Copy link
Contributor

Choose a reason for hiding this comment

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

+1, much cleaner to expect key with prefix removed.

kvs, err := inst.cli.Range(pfx, k)
gomega.Ω(err).To(gomega.BeNil())
gomega.Ω(kvs[0].Key).To(gomega.Equal(append(append(pfx, parser.Delimiter), k...)))
gomega.Ω(kvs[0].Key).To(gomega.Equal(k))
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Signed-off-by: Gyuho Lee <[email protected]>
@gyuho gyuho marked this pull request as ready for review January 6, 2022 19:28

func PutPrefixInfo(db database.KeyValueWriter, prefix []byte, i *PrefixInfo, lastExpiry int64) error {
if i.RawPrefix == (ids.ShortID{}) {
if i.RawPrefix == ids.ShortEmpty {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

❤️

chain/storage.go Outdated
return err
}
expiry := int64(binary.LittleEndian.Uint64(curKey[2 : 2+8]))
expired := int64(binary.LittleEndian.Uint64(curKey[2 : 2+8]))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it may make sense to extract these into a key parsing function

@patrick-ogrady patrick-ogrady merged commit abf66bb into master Jan 6, 2022
@gyuho gyuho deleted the state-expiry branch January 7, 2022 00:43
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.

3 participants