You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "dlmarion (via GitHub)" <gi...@apache.org> on 2026/10/19 17:36:25 UTC

[PR] Encapsulate log sorting task, ZooKeeper serialization [accumulo]

dlmarion opened a new pull request, #6601:
URL: https://github.com/apache/accumulo/pull/6601

   Move the serialization and deserialization of the log sorting task to an object to make future changes easier. RecoveryManager and LogSorter were depending on the format of the string to be the same.
   
   Updated the string to include the sortId and include changes in the upgrade code to rewrite existing ZooKeeper paths to include the sortId.


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Encapsulate log sorting task, ZooKeeper serialization [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #6601:
URL: https://github.com/apache/accumulo/pull/6601#discussion_r4352305989


##########
server/base/src/main/java/org/apache/accumulo/server/log/LogSortWork.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ *   https://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.accumulo.server.log;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.UUID;
+
+/**
+ * The information needed to sort a write-ahead log, and its representation in the recovery work
+ * queue.
+ */
+public record LogSortWork(UUID sortId, String source, String destination) {

Review Comment:
   Looking at how the code works end to end I found that the uuid and destination can be derived from the source.  Below shows how these could be derived using existing code that I found.
   
   ```java
   sortId = LogEntry.fromPath(source).getUniqueID()
   destination = RecoveryPath.getRecoveryPath(new Path(source));
   ```
   
   It **may**, not sure, be cleaner to push the existing LogEntry type further into the recovery code instead of introducing this new LogSortWork type.  May be able to fold the RecoveryPath code into LogEntry as a new `LogEntry.getRecoveryPath()` method.  The only thing we really need to store in the ZK dist queue is the source, do not have to store the uuid and dest since those can be derived.  However if the log SPI changes would result in the source and destination possibly being on different volumes that could change this, then maybe the soruce and dest are needed in ZK but not the sortId.
   
   After sorting a log, the tserver code that does recovery is given the source (from the metadata table) and it derives the destination path from the source.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Encapsulate log sorting task, ZooKeeper serialization [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #6601:
URL: https://github.com/apache/accumulo/pull/6601#discussion_r4352305989


##########
server/base/src/main/java/org/apache/accumulo/server/log/LogSortWork.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ *   https://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.accumulo.server.log;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.UUID;
+
+/**
+ * The information needed to sort a write-ahead log, and its representation in the recovery work
+ * queue.
+ */
+public record LogSortWork(UUID sortId, String source, String destination) {

Review Comment:
   Looking at how the code works end to end I found that the uuid and destination can be derived from the source.  Below shows how these could be derived using existing code that I found.
   
   ```java
   sortId = LogEntry.fromPath(source).getUniqueID()
   destination = RecoveryPath.getRecoveryPath(new Path(source));
   ```
   
   It may be cleaner to push the existing LogEntry type further into the recovery code instead of introducing this new LogSortWork type.  May be able to fold the RecoveryPath code into LogEntry as a new `LogEntry.getRecoveryPath()` method.  The only thing we really need to store in the ZK dist queue is the source, do not have to store the uuid and dest since those can be derived.
   
   After sorting a log, the tserver code that does recovery is given the source (from the metadata table) and it derives the destination path from the source.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Encapsulate log sorting task, ZooKeeper serialization [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #6601:
URL: https://github.com/apache/accumulo/pull/6601#discussion_r4352305989


##########
server/base/src/main/java/org/apache/accumulo/server/log/LogSortWork.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ *   https://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.accumulo.server.log;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.UUID;
+
+/**
+ * The information needed to sort a write-ahead log, and its representation in the recovery work
+ * queue.
+ */
+public record LogSortWork(UUID sortId, String source, String destination) {

Review Comment:
   Looking at how the code works end to end I found that the uuid and destination can be derived from the source.  Below shows how these could be derived using existing code that I found.
   
   ```java
   sortId = LogEntry.fromPath(source).getUniqueID()
   destination = RecoveryPath.getRecoveryPath(new Path(source));
   ```
   
   It **may**, not sure, be cleaner to push the existing LogEntry type further into the recovery code instead of introducing this new LogSortWork type.  May be able to fold the RecoveryPath code into LogEntry as a new `LogEntry.getRecoveryPath()` method.  The only thing we really need to store in the ZK dist queue is the source, do not have to store the uuid and dest since those can be derived.  However if the log SPI changes would result in the source and destination possibly being on different volumes that could change this.
   
   After sorting a log, the tserver code that does recovery is given the source (from the metadata table) and it derives the destination path from the source.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Encapsulate log sorting task, ZooKeeper serialization [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #6601:
URL: https://github.com/apache/accumulo/pull/6601#discussion_r4392479877


##########
server/base/src/main/java/org/apache/accumulo/server/log/LogSortWork.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ *   https://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.accumulo.server.log;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.UUID;
+
+/**
+ * The information needed to sort a write-ahead log, and its representation in the recovery work
+ * queue.
+ */
+public record LogSortWork(UUID sortId, String source, String destination) {

Review Comment:
   Sounds like we need both types. As I was following the code where were one or more functions along the way that passed the fields of LogEntry or LogSortWork instead of using the type.  Would be nice to pass the higher level type along instead.  Then maybe LogSortWork could take a LogEntry during construction, if the functions passed the higher level types more consistently.
   
   We may be able to avoid storing/serializing the sort id in LogSortWork since it can be derived from the source path.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Encapsulate log sorting task, ZooKeeper serialization [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #6601:
URL: https://github.com/apache/accumulo/pull/6601#discussion_r4392479877


##########
server/base/src/main/java/org/apache/accumulo/server/log/LogSortWork.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ *   https://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.accumulo.server.log;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.UUID;
+
+/**
+ * The information needed to sort a write-ahead log, and its representation in the recovery work
+ * queue.
+ */
+public record LogSortWork(UUID sortId, String source, String destination) {

Review Comment:
   Sounds like we need both types. As I was following the code there were one or more functions along the way that passed the fields of LogEntry or LogSortWork instead of using the type.  Would be nice to pass the higher level type along instead.  Then maybe LogSortWork could take a LogEntry during construction, if the functions passed the higher level types more consistently.
   
   We may be able to avoid storing/serializing the sort id in LogSortWork since it can be derived from the source path.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Encapsulate log sorting task, ZooKeeper serialization [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #6601:
URL: https://github.com/apache/accumulo/pull/6601#discussion_r4362474652


##########
server/base/src/main/java/org/apache/accumulo/server/log/LogSortWork.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ *   https://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.accumulo.server.log;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.UUID;
+
+/**
+ * The information needed to sort a write-ahead log, and its representation in the recovery work
+ * queue.
+ */
+public record LogSortWork(UUID sortId, String source, String destination) {

Review Comment:
   I can look at using the LogEntry type in more places rather than introducing the LogSortWork class. I just wanted to centralize the writing and reading of the String that we put in ZooKeeper in one place. In #6598 I'm modifying this String to add the WalProviderId.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Encapsulate log sorting task, ZooKeeper serialization [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #6601:
URL: https://github.com/apache/accumulo/pull/6601#discussion_r4382366101


##########
server/base/src/main/java/org/apache/accumulo/server/log/LogSortWork.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ *   https://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.accumulo.server.log;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.UUID;
+
+/**
+ * The information needed to sort a write-ahead log, and its representation in the recovery work
+ * queue.
+ */
+public record LogSortWork(UUID sortId, String source, String destination) {

Review Comment:
   The LogEntry has the required information for serializing to, and de-serializing from, the tablet metadata. If we added the destination path to LogEntry to also serialize to ZooKeeper, then we would also need to capture this information in the metadata entry.
   
   The LogEntry is inserted into the tablet metadata when the tserver dies, and the destination path is determined at a different time by the RecoveryManager.  We would need to change the existing recovery logic and serialization into the `logs` tablet metadata entry to store the `walog` and predetermined sorted log destination. I feel like that's going to end up being a much bigger change.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org