You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "dcapwell (via GitHub)" <gi...@apache.org> on 2023/12/08 18:49:42 UTC

[PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

dcapwell opened a new pull request, #2976:
URL: https://github.com/apache/cassandra/pull/2976

   (no comment)


-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "bdeggleston (via GitHub)" <gi...@apache.org>.
bdeggleston commented on code in PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#discussion_r1420982064


##########
src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java:
##########
@@ -749,8 +763,16 @@ else if (i < a.length)
      */
     private void handleFlushNotification(Iterable<SSTableReader> added)
     {
-        for (SSTableReader sstable : added)
-            compactionStrategyFor(sstable).addSSTable(sstable);
+        List<GroupedSSTableContainer> groups = groupSSTables(added);

Review Comment:
   it seems like the intent here is to add all sstables with a single lock acquisition from PendingRepairManager, but I'm having trouble seeing why that matters and/or how not doing that can put compaction/repair in a bad state. It  might race with a call to `PendingRepairManager#removeSessionIfEmpty`, but the next call to addSStable will add a strategy for the repair id



##########
src/java/org/apache/cassandra/db/compaction/PendingRepairManager.java:
##########
@@ -483,6 +483,14 @@ public Collection<AbstractCompactionTask> createUserDefinedTasks(Collection<SSTa
         return group.entrySet().stream().map(g -> strategies.get(g.getKey()).getUserDefinedTask(g.getValue(), gcBefore)).collect(Collectors.toList());
     }
 
+    public boolean hasPendingRepairSSTable(TimeUUID sessionID, SSTableReader sstable)

Review Comment:
   could you add  `@VisibleForTesting` for this and the intermediate method in `PendingRepairHolder`? If it's not threadsafe, I'd also add `unsafe` to the method names, along with an explanation of why it's unsafe



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#discussion_r1420906137


##########
src/java/org/apache/cassandra/db/compaction/PendingRepairManager.java:
##########
@@ -483,6 +483,14 @@ public Collection<AbstractCompactionTask> createUserDefinedTasks(Collection<SSTa
         return group.entrySet().stream().map(g -> strategies.get(g.getKey()).getUserDefinedTask(g.getValue(), gcBefore)).collect(Collectors.toList());
     }
 
+    public boolean hasPendingRepairSSTable(TimeUUID sessionID, SSTableReader sstable)

Review Comment:
   this isn't thread-safe, but could make it sync to make sure it is.... I only added for a test...



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#discussion_r1421064433


##########
src/java/org/apache/cassandra/db/compaction/PendingRepairManager.java:
##########
@@ -483,6 +483,14 @@ public Collection<AbstractCompactionTask> createUserDefinedTasks(Collection<SSTa
         return group.entrySet().stream().map(g -> strategies.get(g.getKey()).getUserDefinedTask(g.getValue(), gcBefore)).collect(Collectors.toList());
     }
 
+    public boolean hasPendingRepairSSTable(TimeUUID sessionID, SSTableReader sstable)

Review Comment:
   added `@VisibleForTesting` and `synchronized`... so its now thread safe (with add/remove sstable), but also document that its for tests



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "pmcfadin (via GitHub)" <gi...@apache.org>.
pmcfadin commented on PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#issuecomment-4227139002

   Closing as [CASSANDRA-19182](https://issues.apache.org/jira/browse/CASSANDRA-19182) has been resolved as Fixed — if this PR contains changes not captured in the merged fix, please reopen.


-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#discussion_r1420905275


##########
src/java/org/apache/cassandra/db/compaction/PendingRepairManager.java:
##########
@@ -465,7 +465,7 @@ public boolean hasStrategy(AbstractCompactionStrategy strategy)
 
     public synchronized boolean hasDataForSession(TimeUUID sessionID)
     {
-        return strategies.keySet().contains(sessionID);
+        return strategies.containsKey(sessionID);

Review Comment:
   code cleanup, not correctness issue... just saw while reviewing the code



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "bdeggleston (via GitHub)" <gi...@apache.org>.
bdeggleston commented on code in PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#discussion_r1421060950


##########
src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java:
##########
@@ -749,8 +763,16 @@ else if (i < a.length)
      */
     private void handleFlushNotification(Iterable<SSTableReader> added)
     {
-        for (SSTableReader sstable : added)
-            compactionStrategyFor(sstable).addSSTable(sstable);
+        List<GroupedSSTableContainer> groups = groupSSTables(added);

Review Comment:
   spoke w/ David offline, the previous code fetched the compaction strategy and added to it with 2 lock acquisitions, and the strategy it fetched was getting removed by another operation in the meantime



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#discussion_r1420906824


##########
src/java/org/apache/cassandra/db/lifecycle/Tracker.java:
##########
@@ -508,6 +508,8 @@ void notifyAdded(Iterable<SSTableReader> added, boolean isInitialSSTables)
 
     public void notifySSTableRepairedStatusChanged(Collection<SSTableReader> repairStatusesChanged)
     {
+        if (repairStatusesChanged.isEmpty())

Review Comment:
   kept finding we kept triggering notifications constantly with empty state, which caused us to lock a lot but do nothing... so I can remove this, but figured best to not notify when there is nothing to notify of...



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#discussion_r1420904079


##########
src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java:
##########
@@ -749,8 +763,16 @@ else if (i < a.length)
      */
     private void handleFlushNotification(Iterable<SSTableReader> added)
     {
-        for (SSTableReader sstable : added)
-            compactionStrategyFor(sstable).addSSTable(sstable);
+        List<GroupedSSTableContainer> groups = groupSSTables(added);

Review Comment:
   this is the actual bug fix.  I didn't want to add a new method to do `find + add` using the correct locking when we already had... just requires grouping.
   
   If there is a reason to avoid the grouping, more than glad to create a new method to solve this



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "bdeggleston (via GitHub)" <gi...@apache.org>.
bdeggleston commented on PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#issuecomment-1848013120

   oops, wrong PR!


-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "pmcfadin (via GitHub)" <gi...@apache.org>.
pmcfadin closed pull request #2976: CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming
URL: https://github.com/apache/cassandra/pull/2976


-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSANDRA-19182: IR may leak SSTables with pending repair when coming from streaming [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #2976:
URL: https://github.com/apache/cassandra/pull/2976#discussion_r1420907802


##########
src/java/org/apache/cassandra/repair/RepairCoordinator.java:
##########
@@ -209,6 +213,17 @@ private void fail(String reason)
             reason = error != null ? error.toString() : "Some repair failed";
         }
         state.phase.fail(reason);
+        ParticipateState p = ctx.repair().participate(state.id);

Review Comment:
   when debugging the issue I saw the the vtable knew of the repair, but not the result.  I added the plumbing in so we know success/failure in more cases.
   
   `FailSession` gets used even though its only for updating the vtable for non-ir



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org