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

Error error parsing created field: parsing time "1714686445000000000" as "2006-01-02T15:04:05Z07:00": cannot parse "686445000000000" as "-" #2027

Closed
prologic opened this issue May 3, 2024 · 16 comments
Assignees
Milestone

Comments

@prologic
Copy link

prologic commented May 3, 2024

Not actually sure where this error is coming from. So asking... Was there a recent change in the way Bleve handles and parses Time fields? I have an existing index that I'd rather not have to nuke and start over 😅

@abhinavdangeti
Copy link
Member

@prologic would you perhaps share some sample code and/or more details here that could aid us in reproducing the situation.

@CascadingRadium would you look into this please.

@prologic
Copy link
Author

prologic commented May 3, 2024

All the code is here: https://git.mills.io/yarnsocial/search

Unfortunately I found this out by accident, so I haven't had much time to dig into it to build a reproducer.

I noticed this in a local dev environment, and just (wrongly) assumed my local index db was corrupt, blew it away and thought nothing of it. But this is happening in my production app at https://search.twtxt.net/

Let me know what I can do to help debug this 🙏 I can probably shove the index somewhere for you?

@prologic
Copy link
Author

prologic commented May 3, 2024

Meanwhile I'm going to take a copy of the production index and see if the error reproos locally to debug.

@CascadingRadium
Copy link
Member

hi i have repro'd the issue, will put out the fix soon
thanks

@CascadingRadium
Copy link
Member

fix #2030

CascadingRadium added a commit that referenced this issue May 3, 2024
Addresses #2027

In bleve v2.3.10, [a bug
fix](#1868) was introduced
where the value of a datetime field in the Fields part of a search hit
was made to match the value actually present in the document.
- For example if a document A was indexed and had value of a datetime
field X to be "2001/08/20 03:00:10", and ifA was returned as part of the
search result, A's Fields will have a map which would look like
- Before Fix 
    - "X" : "2001-08-20T03:00:10Z"
- After fix 
    - "X" : "2001/08/20 03:00:10"

This would come to play in case of custom user defined date time parser,
and we did this by storing the layout with which the time string was
parsed with during indexing. With timestamp support being added at the
same time, they did not really have a valid layout to store and hence
stored nil. During queries, the layout extracted, if null, was always
assumed to be for the timestamp case _but_ the case where an existing
index from pre v2.3.10 (which would also return null layout) was not
handled and it became a catchall case leading to the datetime string
being always returned in a timestamp rather than the expected default
RFC3339.
@prologic
Copy link
Author

prologic commented May 3, 2024

Oh wow that was fast! Sorry guys I had to go to bed, I couldn't wait to copy the production DB I have to repro locally which is 2.1G Tar uncompressed 😅 Thanks so much for the fast fix! I assume we'll release/tag a new patch/minor release?

@prologic
Copy link
Author

prologic commented May 4, 2024

Thank you! This bug appears to be fixed!

Example: https://search.twtxt.net/search?q=conv:%23f57rmoq&s=created&s=_id

I upgraded to v2.4.1-0.20240503220319-1a19544cd875 in 3031765b98

@abhinavdangeti abhinavdangeti added this to the v2.4.1 milestone May 13, 2024
@CascadingRadium
Copy link
Member

hi @prologic bleve version v2.4.1 has been released with the fix. please use
github.com/blevesearch/bleve/v2 v2.4.1
in the go.mod thanks

@prologic
Copy link
Author

I hate to report, but this has happened again.

Error error parsing created field: parsing time "1714591133000000000" as "2006-01-02T15:04:05Z07:00": cannot parse "591133000000000" as "-"

Reproducible currently in prod: https://search.twtxt.net/search?q=Hello+World&f=

Notably not all queries are failing.

Also of note, no update to the bleve dependency this time. According to Git blame I'm using github.com/blevesearch/bleve/v2 v2.4.1-0.20240503220319-1a19544cd875 and that was update 2 months ago from this issue report and initial fix.

@abhinavdangeti
Copy link
Member

@prologic giving us a deterministic test case would be greatly helpful.

@CascadingRadium would you take a look into the code to see if if we can spot any other path that could cause this.

@abhinavdangeti abhinavdangeti modified the milestones: v2.4.1, v2.4.2 Jul 19, 2024
@prologic
Copy link
Author

Let me know how I can help provide a reproducible test! I can even provide the data files if that helps as there's nothing sensitive in them. It's all publicly accessible anyway.

@CascadingRadium
Copy link
Member

hi @prologic
from what i see from manual testing

  • every result (search hit), corresponding to a document which is indexed before the time the upgrade, is getting errored out
  • whereas every result (search hit), corresponding to a document which is indexed after the time the upgrade, is getting retrieved correctly

this suggests that somehow the code has fallen back to an old version <2.4.1

could you please confirm that all the dependent libraries of your search service are using atleast v2.4.1

@prologic
Copy link
Author

I'm reasonably confident that the only commit that updated bleve from v2.4.0 to v2.4.1 was: https://git.mills.io/yarnsocial/search/commit/3031765b98dd9a6a85affceb72f6d3707704ac96 no changes in bleve dependencies since.

@prologic
Copy link
Author

At this point would you recommend I rebuild the index? (I can thankfully)

@CascadingRadium
Copy link
Member

yea if that is ok

@prologic
Copy link
Author

Will do! I'll close this issue. Many thanks!

@abhinavdangeti abhinavdangeti modified the milestones: v2.4.2, v2.4.1 Jul 23, 2024
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

No branches or pull requests

3 participants