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

serverutils: clean up some interfaces #107612

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

knz
Copy link
Contributor

@knz knz commented Jul 26, 2023

Epic: CRDB-18499
Part of solving #107058.
Informs #106772.

In this commit:

  • TestTenantInterface renamed to ApplicationLayerInterface.

  • TestServerInterface split into:

    • StorageLayerInterface containing most of the methods previously
      in TestServerInterface.

    • TenantControlInterface with just the methods relating to
      starting the service for secondary tenants.

  • Relevant methods moved from TestServerInterface to
    ApplicationLayerInterface:

    • ServingSQLAddr() - renamed to AdvSQLAddr()
    • RPCAddr()
    • LeaseManager()
    • DistSenderI()
    • MigrationServer()
    • SetDistSQLSpanResolver()
    • CollectionFactory()
    • SystemTableIDResolver()
  • Removed HostSQLAddr() - use .SystemLayer().AdvSQLAddr() instead.

  • AdvSQLAddr() (previously ServingSQLAddr()) was
    simplified to always return the advertised SQL address for the
    current layer.

  • Updated comments/docstrings for the interfaces.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

I like the rename of TenantOrServer for sure and I also like the addition of SystemLayer().

I could see an argument for keeping an embedded ApplicationLayerInterface if we find transitioning tests to this API too difficult, but I'd prefer that we get to this more explicit access if we can.

@knz knz force-pushed the 20230726-test-interface branch from c4299eb to 1836bf2 Compare July 26, 2023 17:35
@knz knz requested a review from a team July 26, 2023 17:35
@knz knz requested review from a team as code owners July 26, 2023 17:35
@knz knz requested a review from a team July 26, 2023 17:35
@knz knz requested review from a team as code owners July 26, 2023 17:35
@knz knz requested review from ericharmeling, shermanCRL and smg260 and removed request for a team July 26, 2023 17:35
@knz knz force-pushed the 20230726-test-interface branch 2 times, most recently from c229b4e to 519f9f9 Compare July 26, 2023 19:53
@knz knz force-pushed the 20230726-test-interface branch from 018d40c to f90d53e Compare July 27, 2023 11:18
Copy link
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ericharmeling, @herkolategan, @shermanCRL, @smg260, and @yuzefovich)


-- commits line 29 at r4:

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: probably worth calling out the change in ServingSQLAddr (which was the only place that had different logic when default test tenant was started), removal of HostSQLAddr method, and inclusion of QueryTableID and friends methods.

Done.


-- commits line 50 at r7:

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: did you mean "important interfaces"?

Indeed. Thanks


pkg/server/testserver.go line 462 at r4 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: XXes on SQLInstanceID and StatusServer in the first commit.

Fixed.


pkg/testutils/serverutils/api.go line 466 at r7 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: should TenantCapabilitiesReader be in TenantControlInterface?

I don't feel it should - it's not a control interface.


pkg/testutils/serverutils/test_server_shim.go line 161 at r4 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: perhaps for the follow-up, but should we rename base.TestTenantArgs and alike too?

Let's do it in a different PR.

Copy link
Collaborator

@herkolategan herkolategan left a comment

Choose a reason for hiding this comment

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

Lovely separation of concerns, and a welcome improvement. I think this will help overall readability in the tests as well. Didn't see anything I don't agree with. Thanks for doing this!

Reviewed 70 of 102 files at r3, 3 of 20 files at r4, 3 of 117 files at r8, 115 of 115 files at r12, 1 of 1 files at r13, 112 of 112 files at r14, 2 of 2 files at r15, 4 of 4 files at r16, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ericharmeling, @shermanCRL, @smg260, and @yuzefovich)

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

Nice work! :lgtm:

Reviewed 1 of 117 files at r8, 7 of 115 files at r12.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ericharmeling, @shermanCRL, and @smg260)

knz added 4 commits July 27, 2023 19:36
In this commit:

- `TestTenantInterface` renamed to `ApplicationLayerInterface`.

- `TestServerInterface` split into:

  - `StorageLayerInterface` containing most of the methods previously
    in `TestServerInterface`.

  - `TenantControlInterface` with just the methods relating to
    starting the service for secondary tenants.

- Relevant methods moved from `TestServerInterface` to
  `ApplicationLayerInterface`:

  - `ServingSQLAddr()` - renamed to `AdvSQLAddr()`
  - `RPCAddr()`
  - `LeaseManager()`
  - `DistSenderI()`
  - `MigrationServer()`
  - `SetDistSQLSpanResolver()`
  - `CollectionFactory()`
  - `SystemTableIDResolver()`

- Removed `HostSQLAddr()` - use `.SystemLayer().AdvSQLAddr()` instead.

- `AdvSQLAddr()` (previously `ServingSQLAddr()`) was
  simplified to always return the advertised SQL address for the
  current layer.

- Updated comments/docstrings for the interfaces.

Release note: None
Prior to this commit, we had methods on TestServer called
"ServingXXXAddr" but under the hood were referring to the advertised
addresses in the config struct. This was confusing.

This patch updates the name of the methods to use "Adv" to be coherent
with the field they are exposing.

Release note: None
@knz knz force-pushed the 20230726-test-interface branch from 77fefc4 to b2992d7 Compare July 27, 2023 17:37
@knz knz requested review from stevendanna and yuzefovich July 27, 2023 17:46
@knz
Copy link
Contributor Author

knz commented Jul 27, 2023

Let's try it!
But i'll avoid batching to ensure if it fails noone else is inconvenienced.

bors r=yuzefovich,stevendanna single on

@yuzefovich
Copy link
Member

Looks like this PR is still included in a batch with others. Perhaps "bors r=..." and "single on" don't work together ref.

bors r+ single on

@craig
Copy link
Contributor

craig bot commented Jul 27, 2023

Already running a review

@yuzefovich
Copy link
Member

bors r-

@craig
Copy link
Contributor

craig bot commented Jul 27, 2023

Canceled.

@yuzefovich
Copy link
Member

bors r+ single on

@craig
Copy link
Contributor

craig bot commented Jul 28, 2023

Timed out.

@knz
Copy link
Contributor Author

knz commented Jul 28, 2023

bors r+ p=99 single on

@craig
Copy link
Contributor

craig bot commented Jul 28, 2023

Build succeeded:

@craig craig bot merged commit 51aa625 into cockroachdb:master Jul 28, 2023
@knz knz deleted the 20230726-test-interface branch July 28, 2023 03:02
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.

5 participants