kfaraz commented on code in PR #15995:
URL: https://github.com/apache/druid/pull/15995#discussion_r1505820170
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java:
##########
@@ -87,23 +87,32 @@ public Optional<String>
getActiveSupervisorIdForDatasourceWithAppendLock(String
final Supervisor supervisor = entry.getValue().lhs;
final SupervisorSpec supervisorSpec = entry.getValue().rhs;
- TaskLockType taskLockType = null;
+ Boolean useConcurrentLocks = Tasks.DEFAULT_USE_CONCURRENT_LOCKS;
+ TaskLockType taskLockType = Tasks.DEFAULT_TASK_LOCK_TYPE;
Review Comment:
```suggestion
boolean hasAppendLock = Tasks.DEFAULT_USE_CONCURRENT_LOCKS;
```
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java:
##########
@@ -87,23 +87,32 @@ public Optional<String>
getActiveSupervisorIdForDatasourceWithAppendLock(String
final Supervisor supervisor = entry.getValue().lhs;
final SupervisorSpec supervisorSpec = entry.getValue().rhs;
- TaskLockType taskLockType = null;
+ Boolean useConcurrentLocks = Tasks.DEFAULT_USE_CONCURRENT_LOCKS;
+ TaskLockType taskLockType = Tasks.DEFAULT_TASK_LOCK_TYPE;
if (supervisorSpec instanceof SeekableStreamSupervisorSpec) {
SeekableStreamSupervisorSpec seekableStreamSupervisorSpec =
(SeekableStreamSupervisorSpec) supervisorSpec;
Map<String, Object> context =
seekableStreamSupervisorSpec.getContext();
if (context != null) {
- taskLockType = QueryContexts.getAsEnum(
- Tasks.TASK_LOCK_TYPE,
- context.get(Tasks.TASK_LOCK_TYPE),
- TaskLockType.class
+ useConcurrentLocks = QueryContexts.getAsBoolean(
+ Tasks.USE_CONCURRENT_LOCKS,
+ context.get(Tasks.USE_CONCURRENT_LOCKS)
);
+
+ if (useConcurrentLocks == null) {
+ useConcurrentLocks = false;
+ taskLockType = QueryContexts.getAsEnum(
+ Tasks.TASK_LOCK_TYPE,
+ context.get(Tasks.TASK_LOCK_TYPE),
+ TaskLockType.class
+ );
+ }
Review Comment:
```suggestion
Boolean useConcurrentLocks = QueryContexts.getAsBoolean(
Tasks.USE_CONCURRENT_LOCKS,
context.get(Tasks.USE_CONCURRENT_LOCKS)
);
if (useConcurrentLocks == null) {
TaskLockType taskLockType = QueryContexts.getAsEnum(
Tasks.TASK_LOCK_TYPE,
context.get(Tasks.TASK_LOCK_TYPE),
TaskLockType.class
);
if (taskLockType == null) {
hasAppendLock = Tasks.DEFAULT_USE_CONCURRENT_LOCKS;
} else if (taskLockType == TaskLockType.APPEND) {
hasAppendLock = true;
} else {
hasAppendLock = false;
}
} else {
hasAppendLock = useConcurrentLocks;
}
```
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java:
##########
@@ -87,23 +87,32 @@ public Optional<String>
getActiveSupervisorIdForDatasourceWithAppendLock(String
final Supervisor supervisor = entry.getValue().lhs;
final SupervisorSpec supervisorSpec = entry.getValue().rhs;
- TaskLockType taskLockType = null;
+ Boolean useConcurrentLocks = Tasks.DEFAULT_USE_CONCURRENT_LOCKS;
+ TaskLockType taskLockType = Tasks.DEFAULT_TASK_LOCK_TYPE;
if (supervisorSpec instanceof SeekableStreamSupervisorSpec) {
SeekableStreamSupervisorSpec seekableStreamSupervisorSpec =
(SeekableStreamSupervisorSpec) supervisorSpec;
Map<String, Object> context =
seekableStreamSupervisorSpec.getContext();
if (context != null) {
- taskLockType = QueryContexts.getAsEnum(
- Tasks.TASK_LOCK_TYPE,
- context.get(Tasks.TASK_LOCK_TYPE),
- TaskLockType.class
+ useConcurrentLocks = QueryContexts.getAsBoolean(
+ Tasks.USE_CONCURRENT_LOCKS,
+ context.get(Tasks.USE_CONCURRENT_LOCKS)
);
+
+ if (useConcurrentLocks == null) {
+ useConcurrentLocks = false;
+ taskLockType = QueryContexts.getAsEnum(
+ Tasks.TASK_LOCK_TYPE,
+ context.get(Tasks.TASK_LOCK_TYPE),
+ TaskLockType.class
+ );
+ }
}
}
if (supervisor instanceof SeekableStreamSupervisor
&& !supervisorSpec.isSuspended()
&& supervisorSpec.getDataSources().contains(datasource)
- && TaskLockType.APPEND.equals(taskLockType)) {
+ && (useConcurrentLocks || TaskLockType.APPEND.equals(taskLockType)))
{
Review Comment:
```suggestion
&& hasAppendLock) {
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]