Riza Suminto has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/21803 )

Change subject: IMPALA-915: Support cancel queries in frontend
......................................................................


Patch Set 46:

(1 comment)

Just have one final check.

http://gerrit.cloudera.org:8080/#/c/21803/43/fe/src/main/java/org/apache/impala/service/Canceller.java
File fe/src/main/java/org/apache/impala/service/Canceller.java:

http://gerrit.cloudera.org:8080/#/c/21803/43/fe/src/main/java/org/apache/impala/service/Canceller.java@44
PS43, Line 44:   // Registers threads by their query ID so the threads can be 
interrupted on
             :   // cancellation.
             :   private static ConcurrentHashMap<TUniqueId, Thread>
             :       queryThreads_ = new ConcurrentHashMap<>();
             :   // Registers that the specified thread has been cancelled and 
should clean up.
             :   private static Set<Thread> cancelledThreads_ = 
ConcurrentHashMap.newKeySet();
> I'm having trouble visualizing that with the need to also be able to tell w
Is it possible to have Canceller class as singleton instead, and compose the 
class like this?

public final class Canceller {
  public static Canceller INSTANCE = new Canceller();

  private Canceller();
  protected void register(TUniqueId queryId);
  protected synchronized void unregister(TUniqueId queryId);
  public synchronized void cancel(TUniqueId queryId);
  public boolean isCancelled();
  public boolean throwIfCancelled();
}

Then, other classes can check through Canceller.INSTANCE. This is common 
pattern we have already such as in RuntimeEnv.INSTANCE, BackendConfig.INSTANCE, 
CatalogMonitor.INSTANCE, etc.



--
To view, visit http://gerrit.cloudera.org:8080/21803
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0d25d4c7fb0b8dcc7dad9510db1e8dca220eeb86
Gerrit-Change-Number: 21803
Gerrit-PatchSet: 46
Gerrit-Owner: Michael Smith <michael.sm...@cloudera.com>
Gerrit-Reviewer: Andrew Sherman <asher...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Gerrit-Reviewer: Jason Fehr <jf...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <joemcdonn...@cloudera.com>
Gerrit-Reviewer: Michael Smith <michael.sm...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <huangquanl...@gmail.com>
Gerrit-Reviewer: Riza Suminto <riza.sumi...@cloudera.com>
Gerrit-Comment-Date: Fri, 06 Jun 2025 21:59:21 +0000
Gerrit-HasComments: Yes

Reply via email to