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

Backport the psql indexer into v0.34.x #6906

Merged
merged 19 commits into from Sep 7, 2021
Merged

Conversation

creachadair
Copy link
Contributor

@creachadair creachadair commented Sep 6, 2021

This change backports the PostgreSQL indexing sink, addressing part of #6828.

Development on the main branch has diverged substantially since the v0.34.x release. It includes package moves, breaking API and protobuf schema changes, and new APIs, all of which together have a large footprint on the mapping between the implementation at tip and the v0.34 release branch.

To avoid the need to retrofit all of those improvements, this change works by injecting the new indexing sink into the existing (v0.34) indexing interfaces by delegation. This means the backport does not pull in all the newer APIs for event handling, and thus has minimal impact on existing code written against the v0.34 package structure.

The high-level structure of this change is:

  • Clone the psql indexing sink from tip, and modify it to remove dependencies on new APIs that are not being ported.
  • Add delegating wrappers to the psql sink for the existing TxIndexer and BlockIndexer types.
  • Back-port the config file changes to document psql as an indexer type and to expose psql-conn. I would have chosen a better name for this setting, but I thought it would be helpful to keep the same name we use at tip.
  • Update the node startup plumbing to enable a psql indexer to be selected.

This change includes the test for the psql implementation, and thus updates some Go module dependencies. However, because it does not interact with any other types, I did not add any unit tests to other packages in this change.

M. J. Fromberger added 9 commits September 7, 2021 06:21
The BackportTxIndexer and BackportBlockIndexer types implement the
corresponding v0.34 indexing interfaces delegated to a psql EventSink.  The
implementations are trivial, but we need to delegate rather than surfacing
another interface because the signatures overlap.
Also update test data to be type-compatible with the old protobuf types.
@codecov
Copy link

codecov bot commented Sep 7, 2021

Codecov Report

❗ No coverage uploaded for pull request base (v0.34.x@0f8932f). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             v0.34.x    #6906   +/-   ##
==========================================
  Coverage           ?   61.51%           
==========================================
  Files              ?      267           
  Lines              ?    27918           
  Branches           ?        0           
==========================================
  Hits               ?    17173           
  Misses             ?     9170           
  Partials           ?     1575           

go.mod Show resolved Hide resolved
state/indexer/sink/psql/backport_test.go Show resolved Hide resolved
state/indexer/sink/psql/psql.go Show resolved Hide resolved
Copy link
Contributor

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for taking this on!!

we probably want to backport the docs as well.

@creachadair
Copy link
Contributor Author

we probably want to backport the docs as well.

Ah, good point, I didn't even think of that. Let me see about adding that to this PR.

M. J. Fromberger added 4 commits September 7, 2021 11:48
Hopefully the newer analyzer will be smarter in later versions,
but for now upgrading triggers a bunch of other issues with the
older code.
Copy link
Contributor

@williambanfield williambanfield left a comment

Choose a reason for hiding this comment

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

LGTM

@creachadair creachadair merged commit 8ba6d21 into v0.34.x Sep 7, 2021
@creachadair creachadair deleted the mjf/psql-backport-paste branch September 7, 2021 22:57
@tac0turtle
Copy link
Contributor

@creachadair creachadair mentioned this pull request Sep 10, 2021
1 task
creachadair pushed a commit that referenced this pull request Oct 4, 2021
I accidentally omitted this from the backport in #6906.
Fixes #7043.
creachadair pushed a commit that referenced this pull request Oct 4, 2021
I accidentally omitted this from the backport in #6906.
Fixes #7043.
iammadab referenced this pull request in dashpay/tenderdash Oct 24, 2021
This change backports the PostgreSQL indexing sink, addressing part of #6828.

Development on the main branch has diverged substantially since the v0.34.x
release. It includes package moves, breaking API and protobuf schema changes,
and new APIs, all of which together have a large footprint on the mapping
between the implementation at tip and the v0.34 release branch.

To avoid the need to retrofit all of those improvements, this change works by
injecting the new indexing sink into the existing (v0.34) indexing interfaces
by delegation. This means the backport does _not_ pull in all the newer APIs
for event handling, and thus has minimal impact on existing code written
against the v0.34 package structure.

This change includes the test for the `psql` implementation, and thus updates
some Go module dependencies. Because it does not interact with any other types,
however, I did not add any unit tests to other packages in this change.

Related changes:
 * Update module dependencies for psql backport.
 * Update test data to be type-compatible with the old protobuf types.
 * Add config settings for the PostgreSQL indexer.
 * Clean up some linter settings.
 * Hook up the psql indexer in the node main.

(cherry picked from commit 8ba6d21)
QuantumExplorer referenced this pull request in dashpay/tenderdash Oct 25, 2021
Backport the psql indexer into v0.34.x (#6906)
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.

None yet

4 participants