提交 e1a91d29 authored 作者: andrei's avatar andrei

full_text_mt

上级 a24af894
...@@ -10,20 +10,22 @@ import java.sql.PreparedStatement; ...@@ -10,20 +10,22 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.HashMap; import java.util.Collections;
import java.util.HashSet; import java.util.Map;
import java.util.Set;
import org.h2.util.New; import org.h2.util.New;
import org.h2.util.SoftHashMap; import org.h2.util.SoftHashMap;
/** /**
* The global settings of a full text search. * The global settings of a full text search.
*/ */
class FullTextSettings { final class FullTextSettings {
/** /**
* The settings of open indexes. * The settings of open indexes.
*/ */
private static final HashMap<String, FullTextSettings> SETTINGS = New.hashMap(); private static final Map<String, FullTextSettings> SETTINGS = Collections.synchronizedMap(New.<String, FullTextSettings>hashMap());
/** /**
* Whether this instance has been initialized. * Whether this instance has been initialized.
...@@ -33,17 +35,17 @@ class FullTextSettings { ...@@ -33,17 +35,17 @@ class FullTextSettings {
/** /**
* The set of words not to index (stop words). * The set of words not to index (stop words).
*/ */
private final HashSet<String> ignoreList = New.hashSet(); private final Set<String> ignoreList = Collections.synchronizedSet(New.<String>hashSet());
/** /**
* The set of words / terms. * The set of words / terms.
*/ */
private final HashMap<String, Integer> words = New.hashMap(); private final Map<String, Integer> words = Collections.synchronizedMap(New.<String, Integer>hashMap());
/** /**
* The set of indexes in this database. * The set of indexes in this database.
*/ */
private final HashMap<Integer, IndexInfo> indexes = New.hashMap(); private final Map<Integer, IndexInfo> indexes = Collections.synchronizedMap(New.<Integer, IndexInfo>hashMap());
/** /**
* The prepared statement cache. * The prepared statement cache.
...@@ -60,7 +62,7 @@ class FullTextSettings { ...@@ -60,7 +62,7 @@ class FullTextSettings {
/** /**
* Create a new instance. * Create a new instance.
*/ */
protected FullTextSettings() { private FullTextSettings() {
// don't allow construction // don't allow construction
} }
...@@ -69,7 +71,7 @@ class FullTextSettings { ...@@ -69,7 +71,7 @@ class FullTextSettings {
* *
* @return the ignore list * @return the ignore list
*/ */
protected HashSet<String> getIgnoreList() { protected Set<String> getIgnoreList() {
return ignoreList; return ignoreList;
} }
...@@ -78,7 +80,7 @@ class FullTextSettings { ...@@ -78,7 +80,7 @@ class FullTextSettings {
* *
* @return the word list * @return the word list
*/ */
protected HashMap<String, Integer> getWordList() { protected Map<String, Integer> getWordList() {
return words; return words;
} }
...@@ -140,7 +142,7 @@ class FullTextSettings { ...@@ -140,7 +142,7 @@ class FullTextSettings {
* @param conn the connection * @param conn the connection
* @return the file system path * @return the file system path
*/ */
protected static String getIndexPath(Connection conn) throws SQLException { private static String getIndexPath(Connection conn) throws SQLException {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery( ResultSet rs = stat.executeQuery(
"CALL IFNULL(DATABASE_PATH(), 'MEM:' || DATABASE())"); "CALL IFNULL(DATABASE_PATH(), 'MEM:' || DATABASE())");
......
...@@ -50,10 +50,6 @@ public class TestFullText extends TestBase { ...@@ -50,10 +50,6 @@ public class TestFullText extends TestBase {
@Override @Override
public void test() throws Exception { public void test() throws Exception {
if (config.multiThreaded) {
// It is even mentioned in the docs that this is not supported
return;
}
testUuidPrimaryKey(false); testUuidPrimaryKey(false);
testAutoAnalyze(); testAutoAnalyze();
testNativeFeatures(); testNativeFeatures();
...@@ -71,7 +67,9 @@ public class TestFullText extends TestBase { ...@@ -71,7 +67,9 @@ public class TestFullText extends TestBase {
testCreateDropLucene(); testCreateDropLucene();
testUuidPrimaryKey(true); testUuidPrimaryKey(true);
testMultiThreaded(true); testMultiThreaded(true);
if(config.mvStore || !config.multiThreaded) {
testMultiThreaded(false); testMultiThreaded(false);
}
testTransaction(true); testTransaction(true);
test(true, "VARCHAR"); test(true, "VARCHAR");
test(true, "CLOB"); test(true, "CLOB");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论