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

bug: sort order ignored in store nodes #2317

Closed
richard-ramos opened this issue Dec 22, 2023 · 15 comments
Closed

bug: sort order ignored in store nodes #2317

richard-ramos opened this issue Dec 22, 2023 · 15 comments
Assignees
Labels
bug Something isn't working status-waku-integ All issues relating to the Status Waku integration.

Comments

@richard-ramos
Copy link
Member

This status.prod node:

/dns4/node-01.do-ams3.status.prod.statusim.net/tcp/30303/p2p/16Uiu2HAm6HZZr7aToTvEBPpiys4UxajCTU97zj5v7RNR2gbniy1D

For the following parameters:

  • PubsubTopic: /waku/2/default-waku/proto
  • ContentTopic: /waku/1/0xee3a5ba0/rfc26
  • Timestamp Range: 1700576989000000000 to 1703255389000000000

Has the following messages, ordered from older to newer (just displaying the timestamps here):

1700844563961868000 = 2023-11-24 16:49:23.961868 +0000 UTC
1700844846355997000 = 2023-11-24 16:54:06.355997 +0000 UTC
1700852345966597000 = 2023-11-24 18:59:05.966597 +0000 UTC
1700855946046026000 = 2023-11-24 19:59:06.046026 +0000 UTC
1701098118321323000 = 2023-11-27 15:15:18.321323 +0000 UTC
1701098294520723000 = 2023-11-27 15:18:14.520723 +0000 UTC
1701098307131975000 = 2023-11-27 15:18:27.131975 +0000 UTC
1701101718529505000 = 2023-11-27 16:15:18.529505 +0000 UTC
1701105016460676000 = 2023-11-27 17:10:16.460676 +0000 UTC
1701105318435566000 = 2023-11-27 17:15:18.435566 +0000 UTC
1701108918465994000 = 2023-11-27 18:15:18.465994 +0000 UTC
1701112518420018000 = 2023-11-27 19:15:18.420018 +0000 UTC
1701116118469684000 = 2023-11-27 20:15:18.469684 +0000 UTC
1701192857989970000 = 2023-11-28 17:34:17.98997 +0000 UTC
1701196757987524000 = 2023-11-28 18:39:17.987524 +0000 UTC
1701200358091385000 = 2023-11-28 19:39:18.091385 +0000 UTC
1701204257965286000 = 2023-11-28 20:44:17.965286 +0000 UTC
1701207971019850000 = 2023-11-28 21:46:11.01985 +0000 UTC
1701274343387457000 = 2023-11-29 16:12:23.387457 +0000 UTC
1701277943176051000 = 2023-11-29 17:12:23.176051 +0000 UTC
1702047637220012000 = 2023-12-08 15:00:37.220012 +0000 UTC
1702047638432107000 = 2023-12-08 15:00:38.432107 +0000 UTC
1702047925439235000 = 2023-12-08 15:05:25.439235 +0000 UTC
1702478856701313000 = 2023-12-13 14:47:36.701313 +0000 UTC
1702478859702027000 = 2023-12-13 14:47:39.702027 +0000 UTC
1702479114012714000 = 2023-12-13 14:51:54.012714 +0000 UTC

In status-go, we're trying to retrieve the messages from newer to older, 3 pages at a time. For this the following query was created:

{
  "request_id":"0102030405060708",
  "query":{
    "pubsub_topic":"/waku/2/default-waku/proto",
    "content_filters":[{"content_topic":"/waku/1/0xee3a5ba0/rfc26"}],
    "start_time":1700576989000000000,
    "end_time":1703255389000000000,
    "paging_info":{
        "page_size":3,
    },
  }
}

Notice that the page ordering is not specified, so according to protobuffer definition, the default BACKWARDS ordering should be applied (i.e. DESC in sql)

With this, we were expecting the first and second page to have the following results:

Page 1:
1702478856701313000 = 2023-12-13 14:47:36.701313 +0000 UTC
1702478859702027000 = 2023-12-13 14:47:39.702027 +0000 UTC
1702479114012714000 = 2023-12-13 14:51:54.012714 +0000 UTC

Page 2:
1702047637220012000 = 2023-12-08 15:00:37.220012 +0000 UTC
1702047638432107000 = 2023-12-08 15:00:38.432107 +0000 UTC
1702047925439235000 = 2023-12-08 15:05:25.439235 +0000 UTC

However the following incorrect ordering is being returned:

Page 1:
1700844563961868000 = 2023-11-24 16:49:23.961868 +0000 UTC
1700844846355997000 = 2023-11-24 16:54:06.355997 +0000 UTC
1700852345966597000 = 2023-11-24 18:59:05.966597 +0000 UTC

Page 2:
1700855946046026000 = 2023-11-24 19:59:06.046026 +0000 UTC
1701098118321323000 = 2023-11-27 15:15:18.321323 +0000 UTC
1701098294520723000 = 2023-11-27 15:18:14.520723 +0000 UTC

To see this scenario in action the following PR from test-waku-query can be used: waku-org/test-waku-query#10

cc: @igor-sirotin

@Ivansete-status
Copy link
Collaborator

I think the issue comes from:

PagingDirection.FORWARD

@richard-ramos
Copy link
Member Author

I see. If that's the case, this default value is not consistent with the default value of the protobuffer. They both should match.

@AlejandroCabeza
Copy link
Contributor

@Ivansete-status Who should fix this? May I, or...?

Btw, just curious, how come did we notice this now? I believe the "forward" as default was already in place.

@richard-ramos
Copy link
Member Author

richard-ramos commented Dec 22, 2023

In status-go this was not noticed until now because we retrieve messages in 1d batches, and each batch seems to load fast enough for the problem to not really be noticeable, but a new feature @igor-sirotin is working on required retrieving and processing messages from newest to oldest, and the content topic on which these messages were published had few messages (~30) so it was easy to notice that the ordering was not correct

@Ivansete-status
Copy link
Collaborator

Ivansete-status commented Dec 22, 2023

I think you already fixed @AlejandroCabeza ! xD
I checked it and the issue happens with nwaku in the following versions:

  • v0.21.1 (current status.prod version)
  • v0.22.0
  • v0.23.0

But it works on master thanks to the ordering consolidation work that you did 🥳
https://github.com/waku-org/nwaku/compare/v0.23.0..07beea02095035f4f4c234ec2dec1f365e6955b8

I will double-check next week (27th'Dec) but we might need to create a patch release v0.23.1 ( cc @gabrielmer )

@AlejandroCabeza
Copy link
Contributor

I think you already fixed @AlejandroCabeza ! xD I checked it and the issue happens with nwaku in the following versions:

* v0.21.1 (current status.prod version)

* v0.22.0

* v0.23.0

But it works on master thanks to the ordering consolidation work that you did 🥳 https://github.com/waku-org/nwaku/compare/v0.23.0..07beea02095035f4f4c234ec2dec1f365e6955b8

I will double-check next week (27th'Dec) but we might need to create a patch release v0.23.1 ( cc @gabrielmer )

Oh, did I? Well, that's great 😂 I'm glad I randomly solved something? 🤣

@chair28980 chair28980 added the status-waku-integ All issues relating to the Status Waku integration. label Jan 2, 2024
@mprakhov
Copy link

mprakhov commented Jan 5, 2024

Hi, @chair28980 - in which fleet I can find the fix? (if it is present there)

@chair28980
Copy link
Contributor

Hi, @chair28980 - in which fleet I can find the fix? (if it is present there)

@mprakhov I'm not sure that this fix is live yet as this issue is still open. @Ivansete-status @AlejandroCabeza can you confirm?

@mprakhov
Copy link

mprakhov commented Jan 5, 2024

This is a high-priority issue now as it impacts fetching the community data. From what I see, we are getting a random order on prod fleet

@Ivansete-status
Copy link
Collaborator

Weekly Update

  • achieved: created v0.23.1-rc.0 and deployed in status.test fleet.
  • next: Deploy v0.23.1 to both status.test and status.prod after having the approval from @richard-ramos and @mprakhov

@igor-sirotin
Copy link

@mprakhov @richard-ramos @Ivansete-status
Do you guys know what's the state of this issue? Was the fix deployed to the fleets?

@mprakhov
Copy link

@igor-sirotin
it was fixed and deployed to shard.test
Pages are coming ordered, msgs in pages in ASC

@igor-sirotin
Copy link

igor-sirotin commented Jan 23, 2024

Just tested the status.prod, seems to be working correct for me now, I suppose it was also already upgraded?

cc @richard-ramos @Ivansete-status

{"envelopeHash": "0xd9ecf2ee6ae9c32688c364f4ac35b32e590fa3913e248b67be0699a887d758a4", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705066820192998000, "timestamp string": "2024-01-12 13:40:20.192998 +0000 GMT"}
{"envelopeHash": "0x162d44ce9b96480524567924c574e8fe841a76e9e6f5621b2d585a45d17cd485", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705070420123304000, "timestamp string": "2024-01-12 14:40:20.123304 +0000 GMT"}
{"envelopeHash": "0xa717b19b7973265f7f2e81707cc19c1309115f540796febd567c8a13b9d77109", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705074020131159000, "timestamp string": "2024-01-12 15:40:20.131159 +0000 GMT"}
{"envelopeHash": "0x57354b5640cdfd84748658c674b7514a634f09d66949eb02618111930b06838a", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705933751431230000, "timestamp string": "2024-01-22 14:29:11.43123 +0000 GMT"}
{"envelopeHash": "0x6278779e25e960c9633fd6b74fdd41cd528e8f1179afafb4c80ac318086a67f7", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705937351498564000, "timestamp string": "2024-01-22 15:29:11.498564 +0000 GMT"}
{"envelopeHash": "0x444d4794fb740dce09319fb6b4e097d1364035ed7080c4e2a09cb831d0dcc1b6", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705940951445069000, "timestamp string": "2024-01-22 16:29:11.445069 +0000 GMT"}
{"envelopeHash": "0xe2262bf2c66f5ca6162ca875d5f79f945ab0e55a0d8edcb7307e8c68c710007b", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705944551458662000, "timestamp string": "2024-01-22 17:29:11.458662 +0000 GMT"}
{"envelopeHash": "0x2f1cf636c1f0ef19f2fd4669c064509d12dcf52b98e56ba3c6d0b938732c885d", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705948151553462000, "timestamp string": "2024-01-22 18:29:11.553462 +0000 GMT"}
{"envelopeHash": "0x45ad89f5e29fc7d4c8634a9761115103a9bdb1dfbb0743d9775f96fcebbc790f", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705951751597182000, "timestamp string": "2024-01-22 19:29:11.597182 +0000 GMT"}
{"envelopeHash": "0xe3351c83d60312d6f63c3460e56c2489f14718f3d7f441395a40057760e72438", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705955351560812000, "timestamp string": "2024-01-22 20:29:11.560812 +0000 GMT"}

@Ivansete-status
Copy link
Collaborator

Just tested the status.prod, seems to be working correct for me now, I suppose it was also already upgraded?

cc @richard-ramos @Ivansete-status

{"envelopeHash": "0xd9ecf2ee6ae9c32688c364f4ac35b32e590fa3913e248b67be0699a887d758a4", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705066820192998000, "timestamp string": "2024-01-12 13:40:20.192998 +0000 GMT"}
{"envelopeHash": "0x162d44ce9b96480524567924c574e8fe841a76e9e6f5621b2d585a45d17cd485", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705070420123304000, "timestamp string": "2024-01-12 14:40:20.123304 +0000 GMT"}
{"envelopeHash": "0xa717b19b7973265f7f2e81707cc19c1309115f540796febd567c8a13b9d77109", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705074020131159000, "timestamp string": "2024-01-12 15:40:20.131159 +0000 GMT"}
{"envelopeHash": "0x57354b5640cdfd84748658c674b7514a634f09d66949eb02618111930b06838a", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705933751431230000, "timestamp string": "2024-01-22 14:29:11.43123 +0000 GMT"}
{"envelopeHash": "0x6278779e25e960c9633fd6b74fdd41cd528e8f1179afafb4c80ac318086a67f7", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705937351498564000, "timestamp string": "2024-01-22 15:29:11.498564 +0000 GMT"}
{"envelopeHash": "0x444d4794fb740dce09319fb6b4e097d1364035ed7080c4e2a09cb831d0dcc1b6", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705940951445069000, "timestamp string": "2024-01-22 16:29:11.445069 +0000 GMT"}
{"envelopeHash": "0xe2262bf2c66f5ca6162ca875d5f79f945ab0e55a0d8edcb7307e8c68c710007b", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705944551458662000, "timestamp string": "2024-01-22 17:29:11.458662 +0000 GMT"}
{"envelopeHash": "0x2f1cf636c1f0ef19f2fd4669c064509d12dcf52b98e56ba3c6d0b938732c885d", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705948151553462000, "timestamp string": "2024-01-22 18:29:11.553462 +0000 GMT"}
{"envelopeHash": "0x45ad89f5e29fc7d4c8634a9761115103a9bdb1dfbb0743d9775f96fcebbc790f", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705951751597182000, "timestamp string": "2024-01-22 19:29:11.597182 +0000 GMT"}
{"envelopeHash": "0xe3351c83d60312d6f63c3460e56c2489f14718f3d7f441395a40057760e72438", "pubsubTopic": "/waku/2/default-waku/proto", "contentTopic": "/waku/1/0xee3a5ba0/rfc26", "timestamp": 1705955351560812000, "timestamp string": "2024-01-22 20:29:11.560812 +0000 GMT"}

Hey @igor-sirotin !
The version v0.23.1 was deployed to status.prod , which contains the fix. I can't check it now as I am afk, but if this fleet has this version then it is expected to work well.
Cheers

@Ivansete-status
Copy link
Collaborator

I close this issue because it was sorted out by @AlejandroCabeza as stated in #2317 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status-waku-integ All issues relating to the Status Waku integration.
Projects
Archived in project
Development

No branches or pull requests

6 participants