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

feat(pd): integrate pd-core into hugegraph #2478

Merged
merged 9 commits into from Apr 19, 2024
Merged

feat(pd): integrate pd-core into hugegraph #2478

merged 9 commits into from Apr 19, 2024

Conversation

VGalaxies
Copy link
Contributor

@VGalaxies VGalaxies commented Mar 14, 2024

subtask of #2265

The corresponding tests will be merged after pd-service

For detailed module analysis documentation, please refer to this link.

VGalaxies and others added 6 commits March 11, 2024 17:03
…to hugegraph (#2460)

subtask of #2265

---

During the code review, I found the following issues:

1. Similar functionality appears multiple times, such as stub connection-related code, with redundancy between `PDClient.StubProxy` and `AbstractClientStubProxy`.
2. Package partitioning:
    1. `PDPulse`, `PDPulseImpl` should in `pulse`
    2. `PDWatch`, `PDWatchImpl` should in `watch`
3. Unused code, see below

---------

Co-authored-by: imbajin <jin@apache.org>
Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 3102 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (pd-store-dev@894bf98). Click here to learn what that means.

Files Patch % Lines
...java/org/apache/hugegraph/pd/PartitionService.java 0.00% 735 Missing ⚠️
...java/org/apache/hugegraph/pd/StoreNodeService.java 0.00% 551 Missing ⚠️
...a/org/apache/hugegraph/pd/TaskScheduleService.java 0.00% 456 Missing ⚠️
...rg/apache/hugegraph/pd/meta/MetadataKeyHelper.java 0.00% 178 Missing ⚠️
...a/org/apache/hugegraph/pd/store/HgKVStoreImpl.java 0.00% 172 Missing ⚠️
...c/main/java/org/apache/hugegraph/pd/KvService.java 0.00% 146 Missing ⚠️
...va/org/apache/hugegraph/pd/meta/PartitionMeta.java 0.00% 115 Missing ⚠️
...g/apache/hugegraph/pd/StoreMonitorDataService.java 0.00% 114 Missing ⚠️
...java/org/apache/hugegraph/pd/meta/IdMetaStore.java 0.00% 102 Missing ⚠️
.../java/org/apache/hugegraph/pd/config/PDConfig.java 0.00% 95 Missing ⚠️
... and 16 more
Additional details and impacted files
@@               Coverage Diff               @@
##             pd-store-dev    #2478   +/-   ##
===============================================
  Coverage                ?   59.33%           
  Complexity              ?      827           
===============================================
  Files                   ?      558           
  Lines                   ?    47575           
  Branches                ?     6479           
===============================================
  Hits                    ?    28228           
  Misses                  ?    16530           
  Partials                ?     2817           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@imbajin imbajin requested review from zyxxoo and imbajin March 14, 2024 09:54
@VGalaxies
Copy link
Contributor Author

VGalaxies commented Mar 17, 2024

@imbajin Do we need to address the Code scanning issues in this PR?

@imbajin
Copy link
Member

imbajin commented Mar 17, 2024

@imbajin Do we need to address the Code scanning issues in this PR?

miss the context, any details?

@VGalaxies
Copy link
Contributor Author

@imbajin Do we need to address the Code scanning issues in this PR?

miss the context, any details?

https://github.com/apache/incubator-hugegraph/pull/2478/checks?check_run_id=22664435037


@Override
public void close() {

Copy link
Contributor

Choose a reason for hiding this comment

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

missing close


import com.google.protobuf.Parser;

public abstract class MetadataStoreBase {
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer interface MetadataStore

* 分区信息管理
*/
@Slf4j
public class PartitionMeta extends MetadataRocksDBStore {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we let PartitionMeta hold a MetadataRocksDBStore instead?


public class QueueStore extends MetadataRocksDBStore {

QueueStore(PDConfig pdConfig) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we keep public/protected mark explicitly

import org.apache.hugegraph.pd.raft.RaftEngine;
import org.apache.hugegraph.pd.store.RaftKVStore;

public class QueueStore extends MetadataRocksDBStore {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we keep a consistent naming style: QueueMetaStore or QueueMeta


@Slf4j
@Service
public class LogService {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we clarify XxLogService


import org.apache.hugegraph.pd.grpc.Metapb;

public interface StoreStatusListener {
Copy link
Contributor

Choose a reason for hiding this comment

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

does the Store mean StoreNode? if yes we can keep StoreNodeStatusListener.

* 4、监测Partition是否需要分裂,监测分裂是否完成
*/
@Slf4j
public class TaskScheduleService {
Copy link
Contributor

Choose a reason for hiding this comment

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

seems it's not a service, prefer to keep TaskScheduler name, and also move to a package
like pd.task


import org.apache.hugegraph.pd.grpc.Metapb;

public interface ShardGroupStatusListener {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move all the Listener files to package pd.listener, and move all the Service files to package pd.service

});
return movedPartitions;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

useless blank line

@javeme
Copy link
Contributor

javeme commented Mar 23, 2024

One more suggestion, we can split the files under the pd client into multiple directories according to functions, and provide Clients.java for navigation(like Clients.createXxClient()). In addition, the files naming of pd proto need to be classified/formatted.

@imbajin
Copy link
Member

imbajin commented Mar 24, 2024

One more suggestion, we can split the files under the pd client into multiple directories according to functions, and provide Clients.java for navigation(like Clients.createXxClient()). In addition, the files naming of pd proto need to be classified/formatted.

@javeme @zyxxoo

The code-style related issues(name/comment/format/clean) may list first(although we already cleaned a lot of them..), the style problems are better to be modified together after reaching TODOs to avoid more inconsistencies under version merge.
For now, we can first focus on the problems in code logic and implementation, which can only be considered as a tradeoff 😿 (so as the PR #2476 )

@VGalaxies
Copy link
Contributor Author

merge directly into the master branch after #2498...

@VGalaxies VGalaxies changed the base branch from pd-store-dev to master April 4, 2024 03:07
@VGalaxies VGalaxies changed the title feat(pd-dev): integrate pd-core into hugegraph feat(pd): integrate pd-core into hugegraph Apr 4, 2024
@VGalaxies VGalaxies marked this pull request as ready for review April 4, 2024 09:42
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. feature New feature labels Apr 4, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 3102 lines in your changes are missing coverage. Please review.

Project coverage is 57.13%. Comparing base (3a1618f) to head (c1ca5bf).
Report is 12 commits behind head on master.

Files Patch % Lines
...java/org/apache/hugegraph/pd/PartitionService.java 0.00% 735 Missing ⚠️
...java/org/apache/hugegraph/pd/StoreNodeService.java 0.00% 551 Missing ⚠️
...a/org/apache/hugegraph/pd/TaskScheduleService.java 0.00% 456 Missing ⚠️
...rg/apache/hugegraph/pd/meta/MetadataKeyHelper.java 0.00% 178 Missing ⚠️
...a/org/apache/hugegraph/pd/store/HgKVStoreImpl.java 0.00% 172 Missing ⚠️
...c/main/java/org/apache/hugegraph/pd/KvService.java 0.00% 146 Missing ⚠️
...va/org/apache/hugegraph/pd/meta/PartitionMeta.java 0.00% 115 Missing ⚠️
...g/apache/hugegraph/pd/StoreMonitorDataService.java 0.00% 114 Missing ⚠️
...java/org/apache/hugegraph/pd/meta/IdMetaStore.java 0.00% 102 Missing ⚠️
.../java/org/apache/hugegraph/pd/config/PDConfig.java 0.00% 95 Missing ⚠️
... and 16 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2478      +/-   ##
============================================
- Coverage     65.64%   57.13%   -8.52%     
  Complexity      827      827              
============================================
  Files           518      605      +87     
  Lines         42987    49334    +6347     
  Branches       5976     6639     +663     
============================================
- Hits          28218    28186      -32     
- Misses        11957    18333    +6376     
- Partials       2812     2815       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@imbajin imbajin added this to the 1.5.0 milestone Apr 5, 2024
@VGalaxies
Copy link
Contributor Author

@imbajin All Code scanning warning have been fixed except for this one:

image

Copy link
Member

@imbajin imbajin left a comment

Choose a reason for hiding this comment

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

THX ❤️~

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 19, 2024
@imbajin imbajin merged commit 43cae1d into master Apr 19, 2024
14 checks passed
@imbajin imbajin deleted the intro-pd-core branch April 19, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature lgtm This PR has been approved by a maintainer pd PD module size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants