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

Cleanup: Remove indexer v1 from codebase #5477

Merged
merged 3 commits into from Jun 21, 2023

Conversation

gmalouf
Copy link
Contributor

@gmalouf gmalouf commented Jun 16, 2023

Summary

Removes the indexer v1 from go-algorand. The API it supported was removed in 2022, making this code no longer needed. Deprecates the command line flag to enable the indexer and removes the configuration file flag entirely.

Test Plan

Unit tests (including backwards compatibiltiy of flag being present in prior config versions but not this one), functional/e2e tests.

@gmalouf gmalouf added the tech debt Things that need re-work for simplification / sanitization to reduce implementation overhead label Jun 16, 2023
@gmalouf gmalouf changed the title Cleanup: Removes indexer v1 from codebase Cleanup: Remove indexer v1 from codebase Jun 16, 2023
@gmalouf gmalouf added Enhancement and removed tech debt Things that need re-work for simplification / sanitization to reduce implementation overhead labels Jun 16, 2023
Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

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

Looks pretty sensible to me, but I don't think we can remove the config value.

cmd/goal/node.go Outdated Show resolved Hide resolved
@@ -237,10 +237,6 @@ type Local struct {
// the max size the sync server would return
TxSyncServeResponseSize int `version[3]:"1000000"`

// IsIndexerActive indicates whether to activate the indexer for fast retrieval of transactions
// Note -- Indexer cannot operate on non Archival nodes
IsIndexerActive bool `version[3]:"false"`
Copy link
Contributor

@winder winder Jun 16, 2023

Choose a reason for hiding this comment

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

Need to leave this in or else we'd config file parsing failures. Even though most configs will have it set to false already, I'm pretty sure unknown fields are illegal.

Copy link
Contributor Author

@gmalouf gmalouf Jun 16, 2023

Choose a reason for hiding this comment

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

I thought that too, but check out the config test - it's loading config versions prior to v28 that have the property without error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Woah. I wonder if its always been that way. Thanks for the correction!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

// To unmarshal JSON into a struct, Unmarshal matches incoming object
// keys to the keys used by Marshal (either the struct field name or its tag),
// preferring an exact match but also accepting a case-insensitive match. By
// default, object keys which don't have a corresponding struct field are
// ignored (see Decoder.DisallowUnknownFields for an alternative).

indeed, what a surprize, I thought it fails like msgp

Copy link
Contributor

Choose a reason for hiding this comment

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

I checked IsIndexerActive=true also deserialized without problems and matches the documentation.

Not sure tho if silently removal config values is a good practice? Maybe there should be some kind of deprecated fields and warning in node.log?

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be cool if our config tagging system supported something like

IsIndexerActive bool `version[3]:"false" version[28]:DEPRECATED`

Copy link
Contributor

Choose a reason for hiding this comment

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

so you could get deprecation warnings logged at startup time

Co-authored-by: Will Winder <wwinder.unh@gmail.com>
@codecov
Copy link

codecov bot commented Jun 16, 2023

Codecov Report

Merging #5477 (02644a8) into master (07f9431) will decrease coverage by 2.91%.
The diff coverage is 57.14%.

@@            Coverage Diff             @@
##           master    #5477      +/-   ##
==========================================
- Coverage   55.64%   52.74%   -2.91%     
==========================================
  Files         448      446       -2     
  Lines       63418    63197     -221     
==========================================
- Hits        35291    33333    -1958     
- Misses      25743    27401    +1658     
- Partials     2384     2463      +79     
Impacted Files Coverage Δ
config/localTemplate.go 33.84% <ø> (-36.93%) ⬇️
daemon/algod/api/server/v2/test/helpers.go 70.83% <ø> (-3.91%) ⬇️
node/node.go 3.64% <0.00%> (-0.40%) ⬇️
cmd/goal/node.go 12.46% <80.00%> (+0.67%) ⬆️

... and 117 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@gmalouf gmalouf marked this pull request as ready for review June 20, 2023 17:26
Copy link
Contributor

@bbroder-algo bbroder-algo left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

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

I guess removal is fine, the config value removal is questionable - yes, it works but is it a good practice? Opinions?

@@ -237,10 +237,6 @@ type Local struct {
// the max size the sync server would return
TxSyncServeResponseSize int `version[3]:"1000000"`

// IsIndexerActive indicates whether to activate the indexer for fast retrieval of transactions
// Note -- Indexer cannot operate on non Archival nodes
IsIndexerActive bool `version[3]:"false"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I checked IsIndexerActive=true also deserialized without problems and matches the documentation.

Not sure tho if silently removal config values is a good practice? Maybe there should be some kind of deprecated fields and warning in node.log?

@gmalouf
Copy link
Contributor Author

gmalouf commented Jun 20, 2023

I'm having trouble of thinking of the downsides of removing it - we know serialization/deserialization works, I'm thinking a call out in the release notes + potentially mentioning in the next consensus upgrade notes might help?

@algorandskiy
Copy link
Contributor

I checked the failure

=== FAIL: node/indexer TestExampleTestSuite (0.29s)
    indexer_test.go:88: 
        	Error:      	Received unexpected error:
        	            	UNIQUE constraint failed: transactions.txid
        	Test:       	TestExampleTestSuite

and it comes from the fact generateTestObjects generates duplicate time to time b/c go1.20 changed random seeding looks like.

There is still an open question what to do with IsIndexerActive removal.

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

Successfully merging this pull request may close these issues.

None yet

5 participants