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

fix create space on empty hosts #2967

Merged

Conversation

darionyaphet
Copy link
Contributor

I do not know why create space on empty hosts .

(root@nebula) [(none)]> add zone z1 "192.168.8.215":55501
Execution succeeded (time spent 4811/5352 us)

Wed, 29 Sep 2021 07:02:34 CST

(root@nebula) [(none)]> show hosts
+-----------------+-------+----------+--------------+----------------------+------------------------+
| Host            | Port  | Status   | Leader count | Leader distribution  | Partition distribution |
+-----------------+-------+----------+--------------+----------------------+------------------------+
| "192.168.8.215" | 55501 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   |
+-----------------+-------+----------+--------------+----------------------+------------------------+
| "Total"         |       |          | 0            |                      |                        |
+-----------------+-------+----------+--------------+----------------------+------------------------+
Got 2 rows (time spent 2761/3784 us)

Wed, 29 Sep 2021 07:02:35 CST

(root@nebula) [(none)]> add group g1 z1
Execution succeeded (time spent 3202/3732 us)

Wed, 29 Sep 2021 07:04:52 CST

(root@nebula) [(none)]> drop host  "192.168.8.215":55501 from zone z1
Execution succeeded (time spent 2439/2968 us)

Wed, 29 Sep 2021 07:04:56 CST

(root@nebula) [(none)]> show zones
+------+------+------+
| Name | Host | Port |
+------+------+------+
| "z1" | ""   | 0    |
+------+------+------+
Got 1 rows (time spent 1969/2678 us)

Wed, 29 Sep 2021 07:05:01 CST

(root@nebula) [(none)]> show groups
+------+------+
| Name | Zone |
+------+------+
| "g1" | "z1" |
+------+------+
Got 1 rows (time spent 2016/2743 us)

Wed, 29 Sep 2021 07:05:03 CST

(root@nebula) [(none)]> create space s (vid_type=int, replica_factor=1, partition_num=1) on g1
[ERROR (-1005)]: Invalid parm!

Wed, 29 Sep 2021 07:05:22 CST

@@ -307,6 +313,12 @@ StatusOr<Hosts> CreateSpaceProcessor::pickHostsWithZone(
hostLoading_[picked] += 1;
pickedHosts.emplace_back(toThriftHost(std::move(picked)));
}

if (code != nebula::cpp2::ErrorCode::SUCCEEDED) {
handleErrorCode(nebula::cpp2::ErrorCode::E_NO_HOSTS);
Copy link
Contributor

Choose a reason for hiding this comment

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

handleErrorCode(code) is better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good Cache & fixed

@bright-starry-sky bright-starry-sky merged commit ddbad22 into vesoft-inc:master Sep 29, 2021
@critical27
Copy link
Contributor

add zone z1 "192.168.8.215":55501
add group g1 z1
drop host  "192.168.8.215":55501 from zone z1

Why the drop can be succeeded?

@bright-starry-sky
Copy link
Contributor

add zone z1 "192.168.8.215":55501
add group g1 z1
drop host  "192.168.8.215":55501 from zone z1

Why the drop can be succeeded?

😄,Am I too positive?

@critical27
Copy link
Contributor

Confirmed with @darionyaphet, it is ok. But we can't drop when we any hosts in zone has a valid space

@bright-starry-sky
Copy link
Contributor

Confirmed with @darionyaphet, it is ok. But we can't drop when we any hosts in zone has a valid space

So, at any time, host cannot be empty when show zones, right? For example, the result below is invalid

(root@nebula) [(none)]> show zones
+------+------+------+
| Name | Host | Port |
+------+------+------+
| "z1" | ""   | 0    |
+------+------+------+
Got 1 rows (time spent 1969/2678 us)

@darionyaphet darionyaphet deleted the fix-create-empty-hosts branch September 29, 2021 01:59
@HarrisChu
Copy link
Contributor

Confirmed with @darionyaphet, it is ok. But we can't drop when we any hosts in zone has a valid space

So, at any time, host cannot be empty when show zones, right? For example, the result below is invalid

(root@nebula) [(none)]> show zones
+------+------+------+
| Name | Host | Port |
+------+------+------+
| "z1" | ""   | 0    |
+------+------+------+
Got 1 rows (time spent 1969/2678 us)
  1. If a host has no partition, it can be dropped from zone, and then add into another zone.
  2. if all hosts in a zone have no partition, then user can drop all hosts in the zone.

@darionyaphet
Copy link
Contributor Author

Confirmed with @darionyaphet, it is ok. But we can't drop when we any hosts in zone has a valid space

So, at any time, host cannot be empty when show zones, right? For example, the result below is invalid

(root@nebula) [(none)]> show zones
+------+------+------+
| Name | Host | Port |
+------+------+------+
| "z1" | ""   | 0    |
+------+------+------+
Got 1 rows (time spent 1969/2678 us)

not correct some times we will replace host in zone and could occur empty hosts

@bright-starry-sky
Copy link
Contributor

Confirmed with @darionyaphet, it is ok. But we can't drop when we any hosts in zone has a valid space

So, at any time, host cannot be empty when show zones, right? For example, the result below is invalid

(root@nebula) [(none)]> show zones
+------+------+------+
| Name | Host | Port |
+------+------+------+
| "z1" | ""   | 0    |
+------+------+------+
Got 1 rows (time spent 1969/2678 us)

not correct some times we will replace host in zone and could occur empty hosts

There are some questions here, I think that at any time a zone must be bound to a host. If user want to replace the host of a zone, must add host to zone first, and then drop the old host from zone. right?

@darionyaphet
Copy link
Contributor Author

Confirmed with @darionyaphet, it is ok. But we can't drop when we any hosts in zone has a valid space

So, at any time, host cannot be empty when show zones, right? For example, the result below is invalid

(root@nebula) [(none)]> show zones
+------+------+------+
| Name | Host | Port |
+------+------+------+
| "z1" | ""   | 0    |
+------+------+------+
Got 1 rows (time spent 1969/2678 us)

not correct some times we will replace host in zone and could occur empty hosts

There are some questions here, I think that at any time a zone must be bound to a host. If user want to replace the host of a zone, must add host to zone first, and then drop the old host from zone. right?

To dispel doubts, I can limit the empty zone hosts

@HarrisChu
Copy link
Contributor

Confirmed with @darionyaphet, it is ok. But we can't drop when we any hosts in zone has a valid space

So, at any time, host cannot be empty when show zones, right? For example, the result below is invalid

(root@nebula) [(none)]> show zones
+------+------+------+
| Name | Host | Port |
+------+------+------+
| "z1" | ""   | 0    |
+------+------+------+
Got 1 rows (time spent 1969/2678 us)

not correct some times we will replace host in zone and could occur empty hosts

There are some questions here, I think that at any time a zone must be bound to a host. If user want to replace the host of a zone, must add host to zone first, and then drop the old host from zone. right?

if a user needs to drop zone, the zone must have no hosts, it may be conflicted.

scenarios here:

  1. add zone with 2 hosts.
  2. before add to a group, rename the zone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants