mirror of https://github.com/apache/druid.git
Merge pull request #2194 from metamx/DRUID-2160
Fixes to JDBCExtractionNamespaceTest
This commit is contained in:
commit
863d84e30e
|
@ -363,7 +363,7 @@ public abstract class NamespaceExtractionCacheManager
|
||||||
tasksStarted.incrementAndGet();
|
tasksStarted.incrementAndGet();
|
||||||
final String newVersion = runnable.call();
|
final String newVersion = runnable.call();
|
||||||
if (preVersion != null && preVersion.equals(newVersion)) {
|
if (preVersion != null && preVersion.equals(newVersion)) {
|
||||||
throw new IllegalStateException("Already exists");
|
throw new CancellationException(String.format("Version `%s` already exists", preVersion));
|
||||||
}
|
}
|
||||||
if (newVersion != null) {
|
if (newVersion != null) {
|
||||||
lastVersion.put(namespaceName, newVersion);
|
lastVersion.put(namespaceName, newVersion);
|
||||||
|
@ -379,6 +379,9 @@ public abstract class NamespaceExtractionCacheManager
|
||||||
} else {
|
} else {
|
||||||
log.error(t, "Failed update namespace [%s]", namespace);
|
log.error(t, "Failed update namespace [%s]", namespace);
|
||||||
}
|
}
|
||||||
|
if(Thread.currentThread().isInterrupted()) {
|
||||||
|
throw Throwables.propagate(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -140,24 +140,7 @@ public class JDBCExtractionNamespaceTest
|
||||||
);
|
);
|
||||||
handle.createStatement(String.format("TRUNCATE TABLE %s", tableName)).setQueryTimeout(1).execute();
|
handle.createStatement(String.format("TRUNCATE TABLE %s", tableName)).setQueryTimeout(1).execute();
|
||||||
handle.commit();
|
handle.commit();
|
||||||
closer.register(
|
closer.register(new Closeable()
|
||||||
new Closeable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void close() throws IOException
|
|
||||||
{
|
|
||||||
// Register first so it gets run last and checks for cleanup
|
|
||||||
final NamespaceExtractionCacheManager.NamespaceImplData implData =
|
|
||||||
extractionCacheManager.implData.get(namespace);
|
|
||||||
if (implData != null && implData.future != null) {
|
|
||||||
implData.future.cancel(true);
|
|
||||||
Assert.assertTrue(implData.future.isDone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
closer.register(
|
|
||||||
new Closeable()
|
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException
|
public void close() throws IOException
|
||||||
|
@ -165,8 +148,21 @@ public class JDBCExtractionNamespaceTest
|
||||||
handle.createStatement("DROP TABLE " + tableName).setQueryTimeout(1).execute();
|
handle.createStatement("DROP TABLE " + tableName).setQueryTimeout(1).execute();
|
||||||
handle.close();
|
handle.close();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
closer.register(new Closeable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException
|
||||||
|
{
|
||||||
|
// Register first so it gets run last and checks for cleanup
|
||||||
|
final NamespaceExtractionCacheManager.NamespaceImplData implData = extractionCacheManager.implData.get(
|
||||||
|
namespace);
|
||||||
|
if (implData != null && implData.future != null) {
|
||||||
|
implData.future.cancel(true);
|
||||||
|
Assert.assertTrue(implData.future.isDone());
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
|
});
|
||||||
for (Map.Entry<String, String> entry : renames.entrySet()) {
|
for (Map.Entry<String, String> entry : renames.entrySet()) {
|
||||||
try {
|
try {
|
||||||
insertValues(entry.getKey(), entry.getValue(), "2015-01-01 00:00:00");
|
insertValues(entry.getKey(), entry.getValue(), "2015-01-01 00:00:00");
|
||||||
|
@ -427,7 +423,6 @@ public class JDBCExtractionNamespaceTest
|
||||||
assertUpdated(extractionNamespace.getNamespace(), "foo", "bar");
|
assertUpdated(extractionNamespace.getNamespace(), "foo", "bar");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore // https://github.com/druid-io/druid/issues/2160
|
|
||||||
@Test(timeout = 60_000L)
|
@Test(timeout = 60_000L)
|
||||||
public void testFindNew()
|
public void testFindNew()
|
||||||
throws NoSuchFieldException, IllegalAccessException, ExecutionException, InterruptedException
|
throws NoSuchFieldException, IllegalAccessException, ExecutionException, InterruptedException
|
||||||
|
|
Loading…
Reference in New Issue