Skip to content
6 changes: 6 additions & 0 deletions extensions-contrib/sqlserver-metadata-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-indexing-service</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jdbi</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,16 @@

import com.fasterxml.jackson.databind.ObjectMapper;

public class SQLServerMetadataStorageActionHandler<EntryType, StatusType, LogType, LockType>
extends SQLMetadataStorageActionHandler<EntryType, StatusType, LogType, LockType>
public class SQLServerMetadataStorageActionHandler extends SQLMetadataStorageActionHandler
{
public SQLServerMetadataStorageActionHandler(
SQLMetadataConnector connector,
ObjectMapper jsonMapper,
MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> types,
String entryTypeName,
String entryTable,
String logTable,
String lockTable
)
{
super(connector, jsonMapper, types, entryTypeName, entryTable, logTable, lockTable);
super(connector, jsonMapper, entryTable, lockTable);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,13 @@ public SQLServerMetadataStorageActionHandlerFactory(
}

@Override
public <EntryType, StatusType, LogType, LockType>
MetadataStorageActionHandler<EntryType, StatusType, LogType, LockType> create(
String entryType,
MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> payloadTypes
)
public MetadataStorageActionHandler create()
{
return new SQLServerMetadataStorageActionHandler<>(
return new SQLServerMetadataStorageActionHandler(
connector,
jsonMapper,
payloadTypes,
entryType,
config.getEntryTable(entryType),
config.getLogTable(entryType),
config.getLockTable(entryType)
config.getTasksTable(),
config.getTaskLockTable()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.apache.druid.metadata.storage.sqlserver;

import junit.framework.Assert;
import org.apache.druid.metadata.MetadataStorageActionHandler;
import org.apache.druid.metadata.storage.sqlserver.SQLServerConnector.CustomStatementRewriter;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -128,8 +129,7 @@ public void testSQLMetadataConnectorCreateTable()

/**
*
* @see org.apache.druid.metadata.SQLMetadataStorageActionHandler#setStatus(String,
* boolean, Object)
* @see MetadataStorageActionHandler#setStatus(String, boolean, org.apache.druid.indexer.TaskStatus)
*
*/
@Test
Expand Down
6 changes: 6 additions & 0 deletions extensions-core/mysql-metadata-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-indexing-service</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,16 @@

import com.fasterxml.jackson.databind.ObjectMapper;

public class MySQLMetadataStorageActionHandler<EntryType, StatusType, LogType, LockType>
extends SQLMetadataStorageActionHandler<EntryType, StatusType, LogType, LockType>
public class MySQLMetadataStorageActionHandler extends SQLMetadataStorageActionHandler
{
MySQLMetadataStorageActionHandler(
SQLMetadataConnector connector,
ObjectMapper jsonMapper,
MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> types,
String entryTypeName,
String entryTable,
String logTable,
String lockTable
)
{
super(connector, jsonMapper, types, entryTypeName, entryTable, logTable, lockTable);
super(connector, jsonMapper, entryTable, lockTable);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,13 @@ public MySQLMetadataStorageActionHandlerFactory(
}

@Override
public <EntryType, StatusType, LogType, LockType>
MetadataStorageActionHandler<EntryType, StatusType, LogType, LockType> create(
String entryType,
MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> payloadTypes
)
public MetadataStorageActionHandler create()
{
return new MySQLMetadataStorageActionHandler<>(
return new MySQLMetadataStorageActionHandler(
connector,
jsonMapper,
payloadTypes,
entryType,
config.getEntryTable(entryType),
config.getLogTable(entryType),
config.getLockTable(entryType)
config.getTasksTable(),
config.getTaskLockTable()
);
}
}
6 changes: 6 additions & 0 deletions extensions-core/postgresql-metadata-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-indexing-service</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,16 @@

import com.fasterxml.jackson.databind.ObjectMapper;

public class PostgreSQLMetadataStorageActionHandler<EntryType, StatusType, LogType, LockType>
extends SQLMetadataStorageActionHandler<EntryType, StatusType, LogType, LockType>
public class PostgreSQLMetadataStorageActionHandler extends SQLMetadataStorageActionHandler
{
public PostgreSQLMetadataStorageActionHandler(
SQLMetadataConnector connector,
ObjectMapper jsonMapper,
MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> types,
String entryTypeName,
String entryTable,
String logTable,
String lockTable
)
{
super(connector, jsonMapper, types, entryTypeName, entryTable, logTable, lockTable);
super(connector, jsonMapper, entryTable, lockTable);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,13 @@ public PostgreSQLMetadataStorageActionHandlerFactory(
}

@Override
public <EntryType, StatusType, LogType, LockType>
MetadataStorageActionHandler<EntryType, StatusType, LogType, LockType> create(
String entryType,
MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> payloadTypes
)
public MetadataStorageActionHandler create()
{
return new PostgreSQLMetadataStorageActionHandler<>(
return new PostgreSQLMetadataStorageActionHandler(
connector,
jsonMapper,
payloadTypes,
entryType,
config.getEntryTable(entryType),
config.getLogTable(entryType),
config.getLockTable(entryType)
config.getTasksTable(),
config.getTaskLockTable()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public MetadataStorageTablesConfig getMetadataStorageTablesConfig()
null,
null,
null,
null,
null
);
}
Expand Down
15 changes: 7 additions & 8 deletions indexing-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
Expand Down Expand Up @@ -263,16 +267,11 @@
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi</artifactId>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
<version>2.48.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
<version>2.48.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* 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.druid.guice;

import com.google.inject.Binder;
import com.google.inject.Key;
import com.google.inject.Module;
import org.apache.druid.discovery.NodeRole;
import org.apache.druid.guice.annotations.LoadScope;
import org.apache.druid.metadata.DerbyMetadataStorageActionHandlerFactory;
import org.apache.druid.metadata.MetadataStorageActionHandlerFactory;
import org.apache.druid.metadata.storage.derby.DerbyMetadataStorageDruidModule;

/**
* Module to bind Derby implementation of {@link MetadataStorageActionHandlerFactory}
* used by {@code MetadataTaskStorage}.
*/
@LoadScope(roles = NodeRole.OVERLORD_JSON_NAME)
public class DerbyTaskStorageModule implements Module
{
@Override
public void configure(Binder binder)
{
PolyBind.createChoiceWithDefault(
binder,
SQLMetadataStorageDruidModule.PROPERTY,
Key.get(MetadataStorageActionHandlerFactory.class),
DerbyMetadataStorageDruidModule.TYPE
);

PolyBind.optionBinder(binder, Key.get(MetadataStorageActionHandlerFactory.class))
.addBinding(DerbyMetadataStorageDruidModule.TYPE)
.to(DerbyMetadataStorageActionHandlerFactory.class)
.in(LazySingleton.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,68 +20,59 @@
package org.apache.druid.indexer;

import com.google.common.base.Preconditions;
import org.apache.druid.indexing.common.task.Task;
import org.joda.time.DateTime;

import javax.annotation.Nullable;

/**
* This class is used to store task info from runner query and cache in OverlordResource
* Contains the {@link TaskStatus} of a {@link Task} and its created time.
*/
public class TaskInfo<EntryType, StatusType>
public class TaskInfo
{
private final String id;
private final DateTime createdTime;
private final StatusType status;
private final String dataSource;
@Nullable
private final EntryType task;
private final TaskStatus status;
private final Task task;

public TaskInfo(
String id,
DateTime createdTime,
StatusType status,
String dataSource,
@Nullable EntryType task
TaskStatus status,
Task task
)
{
this.id = Preconditions.checkNotNull(id, "id");
this.createdTime = Preconditions.checkNotNull(createdTime, "createdTime");
this.status = Preconditions.checkNotNull(status, "status");
this.dataSource = Preconditions.checkNotNull(dataSource, "dataSource");
this.task = task;
this.task = Preconditions.checkNotNull(task, "Task cannot be null");
}

public String getId()
{
return id;
return task.getId();
}

public DateTime getCreatedTime()
{
return createdTime;
}

public StatusType getStatus()
public TaskStatus getStatus()
{
return status;
}

public String getDataSource()
{
return dataSource;
return task.getDataSource();
}

@Nullable
public EntryType getTask()
public Task getTask()
{
return task;
}

/**
* Returns a copy of this TaskInfo object with the given status.
*/
public TaskInfo<EntryType, StatusType> withStatus(StatusType status)
public TaskInfo withStatus(TaskStatus status)
{
return new TaskInfo<>(id, createdTime, status, dataSource, task);
return new TaskInfo(createdTime, status, task);
}
}
Loading