pkuwm commented on a change in pull request #1066:
URL: https://github.com/apache/helix/pull/1066#discussion_r468189260
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
##########
@@ -695,12 +697,6 @@ private void handleEvent(ClusterEvent event,
BaseControllerDataProvider dataProv
event.addAttribute(AttributeName.STATEFUL_REBALANCER.name(),
_rebalancerRef.getRebalancer(manager));
- if (!manager.isLeader()) {
Review comment:
Ah good catch. I intended to replace this line with the new one: check
leader and get session at the same time. But somehow it goes to later right
before invoking pipeline. Resolved.
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/datamodel/SessionAwareZNRecord.java
##########
@@ -0,0 +1,68 @@
+package org.apache.helix.zookeeper.datamodel;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+/**
+ * A class represents a session aware ZNRecord: the ZNRecord should be written
to zk by
+ * the expected zk session. When the ZNRecord is being written to zk, if the
actual
+ * zk session id doesn't match the expected zk session id set in the {@code
SessionAwareZNRecord},
+ * writing to zk will fail. It is supposed to be used within Helix only.
+ * <p>
+ * If this ZNRecord is not supposed to be written only by the expected zk
session,
+ * {@link ZNRecord} is recommended to use.
+ */
+public class SessionAwareZNRecord extends ZNRecord {
+ @JsonIgnore
+ private String expectedSessionId;
+
+ public SessionAwareZNRecord(String id) {
Review comment:
Yes, it is needed in Message constructor:
```
_record = new SessionAwareZNRecord(msgId);
```
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/datamodel/SessionAwareZNRecord.java
##########
@@ -0,0 +1,68 @@
+package org.apache.helix.zookeeper.datamodel;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+/**
+ * A class represents a session aware ZNRecord: the ZNRecord should be written
to zk by
+ * the expected zk session. When the ZNRecord is being written to zk, if the
actual
+ * zk session id doesn't match the expected zk session id set in the {@code
SessionAwareZNRecord},
+ * writing to zk will fail. It is supposed to be used within Helix only.
+ * <p>
+ * If this ZNRecord is not supposed to be written only by the expected zk
session,
+ * {@link ZNRecord} is recommended to use.
+ */
+public class SessionAwareZNRecord extends ZNRecord {
+ @JsonIgnore
+ private String expectedSessionId;
+
+ public SessionAwareZNRecord(String id) {
+ super(id);
+ }
+
+ public SessionAwareZNRecord(ZNRecord record) {
+ super(record);
+ }
+
+ public SessionAwareZNRecord(ZNRecord record, String id) {
Review comment:
Yes in Message constructor:
```
public Message(ZNRecord record, String id) {
_record = new SessionAwareZNRecord(record, id);
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]