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

Implement cdap-tms-spanner extension - Part 1 #15730

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

sidhdirenge
Copy link
Contributor

@sidhdirenge sidhdirenge commented Nov 4, 2024

This PR contains initial implementation of spanner extension of messaging service.

For now conf property : messaging.service.name will decide if spanner messaging service will be used. This part resides in the DelegatingMessagingService implemented earlier.

Follow up PR to contain implementation of other methods in the SpannerMessagingService : especially fetch() and appropriately call destroy() to close spanner clients.

Reference Masoud's POC : develop...features/spanner-tms

Copy link
Contributor

@masoud-io masoud-io left a comment

Choose a reason for hiding this comment

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

the format for extension module is usually as cdap-[spi]-ext-[concrete]
In this case, it should be cdap-messaging-ext-spanner

Copy link
Contributor

@masoud-io masoud-io left a comment

Choose a reason for hiding this comment

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

I recommend to break this PR into two. It'll make the debugging much simpler.

  1. SPI changes and TMS changes.
  2. spanner extension for messaging spi


@Override
public Map<String, String> getProperties() {
String spannerPropertiesPrefix =
Copy link
Contributor

Choose a reason for hiding this comment

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

TMS is one implementation of the messaging SPI. The other implementation will be spanner. So TMS should not have any reference to spanner.

*
* @param messagingContext messaging service context
*/
void destroy(MessagingContext messagingContext);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this? When do you want to close spanner? We probably should keep the client open in spanner messaging service in appfabric, otherwise it'll hurt the performance substantially.

+ " (OLDER_THAN(publish_ts, INTERVAL 7 DAY))", getTableName(topicId), SEQUENCE_ID_FIELD,
PAYLOAD_SEQUENCE_ID, PUBLISH_TS_FIELD, PAYLOAD_FIELD);
OperationFuture<Void, UpdateDatabaseDdlMetadata> future = adminClient.updateDatabaseDdl(
SpannerUtil.getInstanceID(cConf), SpannerUtil.getDatabaseID(cConf),
Copy link
Contributor

Choose a reason for hiding this comment

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

initialize instanceId, databaseId, etc at the beginning and reuse those fields. It'll be much simpler than calling SpannerUtil.getInstanceID(cConf), SpannerUtil.getDatabaseID(cConf), etc

try {
future.get();
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error when executing {}", topicSQL, e);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not log and forget the exception. Check the handleError in ClientMessagingService

}
}

public static String getTableName(TopicId topicId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why public?

try {
Thread.sleep(5);
} catch (InterruptedException e) {
LOG.error("error during sleep", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not log and forget exceptions

@itsankit-google itsankit-google added the build Triggers github actions build label Nov 7, 2024
Copy link

sonarcloud bot commented Nov 7, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

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

Successfully merging this pull request may close these issues.

3 participants