Re: [PR] Create a class for MailboxId [pinot]
gortiz commented on code in PR #12955: URL: https://github.com/apache/pinot/pull/12955#discussion_r1578988925 ## pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/MailboxId.java: ## @@ -0,0 +1,104 @@ +/** + * 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. + */ +package org.apache.pinot.query.planner.physical; + +import java.util.Objects; + + +public class MailboxId { + public static final char SEPARATOR = '|'; + + private final long _requestId; + private final int _senderStageId; + private final int _senderWorkerId; + private final int _receiverStageId; + private final int _receiverWorkerId; + + public MailboxId(long requestId, int senderStageId, int senderWorkerId, int receiverStageId, int receiverWorkerId) { +_requestId = requestId; +_senderStageId = senderStageId; +_senderWorkerId = senderWorkerId; +_receiverStageId = receiverStageId; +_receiverWorkerId = receiverWorkerId; + } + + public long getRequestId() { +return _requestId; + } + + public int getSenderStageId() { +return _senderStageId; + } + + public int getSenderWorkerId() { +return _senderWorkerId; + } + + public int getReceiverStageId() { +return _receiverStageId; + } + + public int getReceiverWorkerId() { +return _receiverWorkerId; + } + + public static MailboxId fromPipeString(String mailboxIdStr) { +String[] parts = mailboxIdStr.split("\\" + SEPARATOR); Review Comment: Changed to do not allocate (and fail with better messages) -- 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. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org
Re: [PR] Create a class for MailboxId [pinot]
gortiz commented on PR #12955: URL: https://github.com/apache/pinot/pull/12955#issuecomment-2076503675 > How about we introducing a util which takes the pipe format mailbox id and convert it to the pretty format? Then we can use it when we want a nicer message. I think that goes against the idea you explained in the first comment and in fact that is similar to what this PR does. IICU your first comment, you indicated that you think in the future we may change the format of the mailbox id to something that does not carry the same information. If that is the case, we cannot assume that in the future we are going to be able to extract, from the mailbox id, the stage and other information that can be useful in the messages. Maybe what you wanted to say is that we may want to change the format (but not the content) of the mailbox id in the future. In that case this current proposed implementation is fine because this PR does not modify the format used to send the mailbox id in the binary protocol. Instead it keeps in memory a MailboxId object but when it is serialized/deserialized it is converted to the current string form. So instead of having to use a util to extract a human description from the current mailbox id, this PR extracts the information beforehand when the message is deserialized and keeps it in memory. Given the information carried by the mailbox id is mostly integers, this object representation is probably more memory efficient than the String and it is for sure easier to read (for example, having a `List` is easier to understand than `List`). -- 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. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org
Re: [PR] Create a class for MailboxId [pinot]
gortiz commented on code in PR #12955: URL: https://github.com/apache/pinot/pull/12955#discussion_r1578979378 ## pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/MailboxId.java: ## @@ -0,0 +1,104 @@ +/** + * 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. + */ +package org.apache.pinot.query.planner.physical; + +import java.util.Objects; + + +public class MailboxId { + public static final char SEPARATOR = '|'; + + private final long _requestId; + private final int _senderStageId; + private final int _senderWorkerId; + private final int _receiverStageId; + private final int _receiverWorkerId; + + public MailboxId(long requestId, int senderStageId, int senderWorkerId, int receiverStageId, int receiverWorkerId) { +_requestId = requestId; +_senderStageId = senderStageId; +_senderWorkerId = senderWorkerId; +_receiverStageId = receiverStageId; +_receiverWorkerId = receiverWorkerId; + } + + public long getRequestId() { +return _requestId; + } + + public int getSenderStageId() { +return _senderStageId; + } + + public int getSenderWorkerId() { +return _senderWorkerId; + } + + public int getReceiverStageId() { +return _receiverStageId; + } + + public int getReceiverWorkerId() { +return _receiverWorkerId; + } + + public static MailboxId fromPipeString(String mailboxIdStr) { +String[] parts = mailboxIdStr.split("\\" + SEPARATOR); +return new MailboxId(Long.parseLong(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), +Integer.parseInt(parts[3]), Integer.parseInt(parts[4])); + } + + public String toPipeString() { +return Long.toString(_requestId) + SEPARATOR + _senderStageId + SEPARATOR + _senderWorkerId + SEPARATOR ++ _receiverStageId + SEPARATOR + _receiverWorkerId; + } + + @Override + public String toString() { +// CHECKSTYLE:OFF Review Comment: I think I can remove the `CHECKSTYLE:OFF`, it is the `@formatter:off` what it was actually useful to tell intellij (and other editors) to do not reformat the line. -- 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. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org
Re: [PR] Create a class for MailboxId [pinot]
Jackie-Jiang commented on PR #12955: URL: https://github.com/apache/pinot/pull/12955#issuecomment-2075451380 > I've created this PR mainly to have a nicer message in some cases. For example, when there is a timeout sending to some mailbox the current name is quite difficult to understand even for Pinot devs. How about we introducing a util which takes the pipe format mailbox id and convert it to the pretty format? Then we can use it when we want a nicer message. -- 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. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org
Re: [PR] Create a class for MailboxId [pinot]
gortiz commented on PR #12955: URL: https://github.com/apache/pinot/pull/12955#issuecomment-2075167318 I've created this PR mainly to have a nicer message in some cases. For example, when there is a timeout sending to some mailbox the current name is quite difficult to understand even for Pinot devs. -- 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. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org
Re: [PR] Create a class for MailboxId [pinot]
Jackie-Jiang commented on code in PR #12955: URL: https://github.com/apache/pinot/pull/12955#discussion_r1569665249 ## pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/MailboxId.java: ## @@ -0,0 +1,104 @@ +/** + * 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. + */ +package org.apache.pinot.query.planner.physical; + +import java.util.Objects; + + +public class MailboxId { + public static final char SEPARATOR = '|'; + + private final long _requestId; + private final int _senderStageId; + private final int _senderWorkerId; + private final int _receiverStageId; + private final int _receiverWorkerId; + + public MailboxId(long requestId, int senderStageId, int senderWorkerId, int receiverStageId, int receiverWorkerId) { +_requestId = requestId; +_senderStageId = senderStageId; +_senderWorkerId = senderWorkerId; +_receiverStageId = receiverStageId; +_receiverWorkerId = receiverWorkerId; + } + + public long getRequestId() { +return _requestId; + } + + public int getSenderStageId() { +return _senderStageId; + } + + public int getSenderWorkerId() { +return _senderWorkerId; + } + + public int getReceiverStageId() { +return _receiverStageId; + } + + public int getReceiverWorkerId() { +return _receiverWorkerId; + } + + public static MailboxId fromPipeString(String mailboxIdStr) { +String[] parts = mailboxIdStr.split("\\" + SEPARATOR); +return new MailboxId(Long.parseLong(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), +Integer.parseInt(parts[3]), Integer.parseInt(parts[4])); + } + + public String toPipeString() { +return Long.toString(_requestId) + SEPARATOR + _senderStageId + SEPARATOR + _senderWorkerId + SEPARATOR ++ _receiverStageId + SEPARATOR + _receiverWorkerId; + } + + @Override + public String toString() { +// CHECKSTYLE:OFF Review Comment: Checkstyle also doesn't like this? ## pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/MailboxId.java: ## @@ -0,0 +1,104 @@ +/** + * 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. + */ +package org.apache.pinot.query.planner.physical; + +import java.util.Objects; + + +public class MailboxId { + public static final char SEPARATOR = '|'; + + private final long _requestId; + private final int _senderStageId; + private final int _senderWorkerId; + private final int _receiverStageId; + private final int _receiverWorkerId; + + public MailboxId(long requestId, int senderStageId, int senderWorkerId, int receiverStageId, int receiverWorkerId) { +_requestId = requestId; +_senderStageId = senderStageId; +_senderWorkerId = senderWorkerId; +_receiverStageId = receiverStageId; +_receiverWorkerId = receiverWorkerId; + } + + public long getRequestId() { +return _requestId; + } + + public int getSenderStageId() { +return _senderStageId; + } + + public int getSenderWorkerId() { +return _senderWorkerId; + } + + public int getReceiverStageId() { +return _receiverStageId; + } + + public int getReceiverWorkerId() { +return _receiverWorkerId; + } + + public static MailboxId fromPipeString(String mailboxIdStr) { +String[] parts = mailboxIdStr.split("\\" + SEPARATOR); Review Comment: Suggest using `StringUtils.split(mailboxIdStr, '|')` for efficiency -- This is an automated message from the Apache Git Service. To respo
Re: [PR] Create a class for MailboxId [pinot]
codecov-commenter commented on PR #12955: URL: https://github.com/apache/pinot/pull/12955#issuecomment-2061372178 ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/12955?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report Attention: Patch coverage is `0%` with `37 lines` in your changes are missing coverage. Please review. > Project coverage is 0.00%. Comparing base [(`59551e4`)](https://app.codecov.io/gh/apache/pinot/commit/59551e45224f1535c4863fd577622b37366ccc97?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`364c46a`)](https://app.codecov.io/gh/apache/pinot/pull/12955?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache). > Report is 317 commits behind head on master. | [Files](https://app.codecov.io/gh/apache/pinot/pull/12955?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines | |---|---|---| | [...apache/pinot/query/planner/physical/MailboxId.java](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&filepath=pinot-query-planner%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fplanner%2Fphysical%2FMailboxId.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcGxhbm5lci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcGxhbm5lci9waHlzaWNhbC9NYWlsYm94SWQuamF2YQ==) | 0.00% | [24 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | | [.../query/mailbox/channel/MailboxContentObserver.java](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fmailbox%2Fchannel%2FMailboxContentObserver.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvbWFpbGJveC9jaGFubmVsL01haWxib3hDb250ZW50T2JzZXJ2ZXIuamF2YQ==) | 0.00% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | | [...e/pinot/query/planner/physical/MailboxIdUtils.java](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&filepath=pinot-query-planner%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fplanner%2Fphysical%2FMailboxIdUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcGxhbm5lci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcGxhbm5lci9waHlzaWNhbC9NYWlsYm94SWRVdGlscy5qYXZh) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | | [...apache/pinot/query/mailbox/GrpcSendingMailbox.java](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fmailbox%2FGrpcSendingMailbox.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvbWFpbGJveC9HcnBjU2VuZGluZ01haWxib3guamF2YQ==) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | | [...org/apache/pinot/query/mailbox/MailboxService.java](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fmailbox%2FMailboxService.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvbWFpbGJveC9NYWlsYm94U2VydmljZS5qYXZh) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | | [...va/org/apache/pinot/query/routing/RoutingInfo.java](https://app.codecov.io/gh/apache/pinot/pull/12955?src=pr&el=tree&filepath=pinot-query-planner%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Frouting%2FRoutingInfo.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcGxhbm5lci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub