-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use listenerId to distinguish multiple add listeners to one space #5032
Use listenerId to distinguish multiple add listeners to one space #5032
Conversation
7ac5b19
to
6fa6783
Compare
eae158d
to
26243ab
Compare
Codecov ReportBase: 77.24% // Head: 77.26% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #5032 +/- ##
==========================================
+ Coverage 77.24% 77.26% +0.02%
==========================================
Files 1105 1105
Lines 82054 82185 +131
==========================================
+ Hits 63383 63503 +120
- Misses 18671 18682 +11
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
26243ab
to
3d59de6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen when this PR merged:
- Does existing listener could start up by
NebulaStore::loadLocalListenerFromPartManager
? - If 1 works, what is the listener id of existing listener?
I guess we will crash.
return *reinterpret_cast<const PartitionID*>(rawData.data() + offset); | ||
} | ||
|
||
ListenerID MetaKeyUtils::parseListenerId(folly::StringPiece rawData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you need to handle the old existing data which does not have listener id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
Compatibility has already supported.
The listener id's problem (what you discussed that we need remove -> wait -> add), I think we could leave it alone and mark as known issue. My concern is that this PR only works for new cluster but not the existing one. |
3d59de6
to
adf933a
Compare
adf933a
to
48099f3
Compare
Before the upgrade if there is listener, after the upgrade: |
48099f3
to
06b3863
Compare
There is a listener before the upgrade, and it can continue to execute after the upgrade. already tested.@critical27 |
ListListenerResp listListener(1: ListListenerReq req); | ||
ExecResp addListener(1: AddListenerReq req); | ||
ExecResp removeListener(1: RemoveListenerReq req); | ||
ListListenersResp listListeners(1: ListListenersReq req); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the change of this interface affect the compatibility of different nebula version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
There is a compatibility effect. I think it can be ignored.
There are two reasons:
- This interface is only used by the kernel, not uses by other tools.
- The purpose of changing this interface is to keep it consistent with the interface of the enterprise version.
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Description:
Use listenerId to distinguish different add listeners.
Synchronized from the enterprise version https://github.com/vesoft-inc/nebula-ent/pull/1860.
solve the problem of adding listener immediately after remove listener.
close Use listenerId to distinguish multiple add listeners to one space #5027
Modify the code to keep the community version and enterprise version consistent
and optimize some code to make the code cleaner.
Add UT and improve UT code
How do you solve it?
Because remove listener and add listener are asynchronous operations.
In the past, after removing the listener, you need to wait for a while to add the listener, otherwise an error will occur.
After the current modification, after remove listener, you can add listener immediately.
Test case as follows:
step 1:
create space space1(partition_num=1, replica_factor=1, vid_type = FIXED_STRING(30));
use space1
create tag player(name string, age int);
insert vertex player(name, age) values "11":("aaaa",1);
insert vertex player(name, age) values "22":("aaaa",2);
insert vertex player(name, age) values "33":("aaaa",3);
insert vertex player(name, age) values "44":("aaaa",4);
FETCH PROP ON player "11" yield player.name;
sign in text service(192.168.8.215:47500);
show text search clients;
step2:
add listener ELASTICSEARCH 192.168.8.211:56700;
show listener
step 3:
REMOVE LISTENER ELASTICSEARCH;
show listener
add listener ELASTICSEARCH 192.168.8.211:56700;
show listener
step 4:
The value in the ListenerId file is different, meet our expectations.
The first ListenerId:
:
$ ll/nebula_test_tool$ ./readListenerId xxxx/storage_listener/listener/1/1/wal/listnenerId18:35 listnenerId
:
listenerId 3
The second ListenerId:
:
$ ll/nebula_test_tool$ ./readListenerId xxxxx/storage_listener/listener/1/1/wal/listnenerId18:38 listnenerId
:
listenerId 4
Special notes for your reviewer, ex. impact of this fix, design document, etc:
Checklist:
Tests:
Affects:
Release notes:
Please confirm whether to be reflected in release notes and how to describe: