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

[DSIP-56] Refactor JDBC registry support session timeout and data change event #16287

Conversation

ruanwenjun
Copy link
Member

@ruanwenjun ruanwenjun commented Jul 8, 2024

Purpose of the pull request

close #16278

Brief change log

  • Refactor the JDBC Registry
  • Change default registry of standalone to jdbc

Verify this pull request

Test by UT and E2E

Pull Request Notice

Pull Request Notice

If your pull request contain incompatible change, you should also add it to docs/docs/en/guide/upgrede/incompatible.md

.build());
return;
}
log.debug("{} acquire the lock {} success", lockOwner, lockKey);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
.build());
return true;
}
log.debug("{} acquire the lock {} success", lockOwner, lockKey);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch 6 times, most recently from 14c7651 to d2ac15a Compare July 8, 2024 12:30
@ruanwenjun ruanwenjun added the DSIP label Jul 8, 2024
@ruanwenjun ruanwenjun added this to the 3.3.0 milestone Jul 8, 2024
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch 5 times, most recently from 379dae8 to af80ef4 Compare July 8, 2024 15:06
@ruanwenjun ruanwenjun marked this pull request as ready for review July 8, 2024 16:29
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch 4 times, most recently from 11409b9 to c93008c Compare July 9, 2024 11:31
@github-actions github-actions bot added the CI&CD label Jul 9, 2024
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch from c93008c to 4106238 Compare July 9, 2024 11:32
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch from 4106238 to caefdd0 Compare July 9, 2024 15:02
"\n sessionTimeout -> " + sessionTimeout +
"\n hikariConfig -> " + hikariConfig +
"\n****************************JdbcRegistryProperties**************************************";
log.info(config);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch from d53f811 to 1b3c3aa Compare July 10, 2024 04:26
@ruanwenjun ruanwenjun requested a review from SbloodyS July 10, 2024 11:47
SbloodyS
SbloodyS previously approved these changes Jul 11, 2024
Copy link
Member

@SbloodyS SbloodyS left a comment

Choose a reason for hiding this comment

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

LGTM

DEFAULT CHARSET = utf8;

DROP TABLE IF EXISTS `t_ds_jdbc_registry_client_heartbeat`;
CREATE TABLE `t_ds_jdbc_registry_client_heartbeat`
Copy link
Contributor

Choose a reason for hiding this comment

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

Heartbeat is just an attribute of client, so maybe registry_client is better.

Suggested change
CREATE TABLE `t_ds_jdbc_registry_client_heartbeat`
CREATE TABLE `t_ds_jdbc_registry_client`
Copy link
Member Author

Choose a reason for hiding this comment

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

The origin table name is t_ds_jdbc_registry_client, but I am worried this will conflict with JdbcRegistryClient which is already exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's OK because it has t_ds prefix, and what about using DsJdbcRegistryClient as entity class name?

(
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`event_type` varchar(64) NOT NULL COMMENT 'ADD, UPDATE, DELETE',
`jdbc_registry_data` text NOT NULL COMMENT 'jdbc registry data',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`jdbc_registry_data` text NOT NULL COMMENT 'jdbc registry data',
`registry_data` text NOT NULL COMMENT 'registry data',
Copy link
Member Author

Choose a reason for hiding this comment

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

Use jdbc_registry_data may better to know the data is from t_ds_jdbc_registry_data

@Select("select max(id) from t_ds_jdbc_registry_data_change_event")
Long getMaxId();

@Select("select * from t_ds_jdbc_registry_data_change_event where id > #{id} order by id asc limit 1000")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Select("select * from t_ds_jdbc_registry_data_change_event where id > #{id} order by id asc limit 1000")
@Select("select * from t_ds_jdbc_registry_data_change_event where id > #{id} limit 1000")
Copy link
Member Author

Choose a reason for hiding this comment

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

Directly announce the order is better to let others know we need to make sure the result have order here.


void subscribeRegistryRowChange(RegistryRowChangeListener<T> registryRowChangeListener);

interface RegistryRowChangeListener<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

RegistryRow means RegistryData?

Copy link
Contributor

Choose a reason for hiding this comment

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

row is a database concept, and it is best to use logical concepts.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is not only represent to RegistryData, but now only have RegistryData implemenration, this interface is used to notify the jdbc row add/update/delete, so we can directly use jdbc concepts here.

@ruanwenjun ruanwenjun force-pushed the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch from ecc3e97 to c6ead62 Compare July 11, 2024 09:10
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch from c6ead62 to f0578f7 Compare July 11, 2024 10:34
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch from f0578f7 to 99b6ce1 Compare July 12, 2024 05:38
Copy link

sonarcloud bot commented Jul 12, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 60%)
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

Copy link
Contributor

@caishunfeng caishunfeng left a comment

Choose a reason for hiding this comment

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

LGTM overall

Copy link
Member

@SbloodyS SbloodyS left a comment

Choose a reason for hiding this comment

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

+1

@ruanwenjun ruanwenjun merged commit 2db8098 into apache:dev Jul 12, 2024
66 of 68 checks passed
@ruanwenjun ruanwenjun deleted the dev_wenjun_supportSessionTimeoutInJdbcRegistry branch July 12, 2024 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment