Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update recency issue with expanded test coverage #63

Merged
merged 7 commits into from
Oct 19, 2023

Conversation

arik-so
Copy link
Contributor

@arik-so arik-so commented Oct 16, 2023

No description provided.

@arik-so arik-so force-pushed the 2023/10/ordering_fix branch from d02d1bc to 54a0d67 Compare October 16, 2023 15:31
@arik-so arik-so changed the title Test full snapshot recency. Fix update recency issue with expanded test coverage Oct 19, 2023
src/persistence.rs Outdated Show resolved Hide resolved
src/tests/mod.rs Outdated Show resolved Hide resolved
src/tests/mod.rs Outdated Show resolved Hide resolved
@@ -143,7 +143,7 @@ pub(crate) fn db_index_creation_query() -> &'static str {
CREATE INDEX IF NOT EXISTS channel_updates_scid_dir_seen_desc_with_id ON channel_updates(short_channel_id ASC, direction ASC, seen DESC) INCLUDE (id);
CREATE UNIQUE INDEX IF NOT EXISTS channel_updates_key ON channel_updates (short_channel_id, direction, timestamp);
CREATE INDEX IF NOT EXISTS channel_updates_seen ON channel_updates(seen);
CREATE INDEX IF NOT EXISTS channel_updates_timestamp_desc ON channel_updates(timestamp DESC);
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you check that this is now unused?

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 only tested the specific query that I now changed, but prepending short_channel_id ASC does make it no longer use that index.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, my question was if any other queries use that index.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other three channel_update queries don't seem to be using it with my local test database, but my postgres seems to occasionally select indices distinct from yours, so you may wanna double-check your instance, too

Copy link
Contributor

Choose a reason for hiding this comment

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

Mine doesn't seem to either.

@arik-so arik-so force-pushed the 2023/10/ordering_fix branch from 248b8b1 to 0aff71f Compare October 19, 2023 19:24
@@ -111,7 +111,7 @@ impl<L: Deref> GossipPersister<L> where L::Target: Logger {
}

match &gossip_message {
GossipMessage::ChannelAnnouncement(announcement) => {
GossipMessage::ChannelAnnouncement(announcement, _) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add the override field if we can't use it?

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 haven't added the unit test for an old announcement yet that was gonna use it. I can do that now to make sure this does end up finding some use immediately.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's alright, I just feel weird adding it freestanding but if you already have code queued up to use it we'll survive.

@TheBlueMatt TheBlueMatt merged commit 86ebd80 into lightningdevkit:main Oct 19, 2023
4 checks passed
@arik-so
Copy link
Contributor Author

arik-so commented Oct 19, 2023

This should have fixed #61, but please let us know if you continue to see issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants