Skip to content

Commit

Permalink
Removed some old attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
amccurry committed Mar 12, 2012
1 parent 961092c commit 0aa6a01
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 32 deletions.
Expand Up @@ -168,7 +168,7 @@ public void fetchRow(String table, Selector selector, FetchResult fetchResult) t
}
IndexReader reader = null;
try {
reader = index.getIndexReader(!selector.allowStaleData);
reader = index.getIndexReader();
fetchRow(reader, table, selector, fetchResult);
if (_blurMetrics != null) {
if (fetchResult.rowResult != null) {
Expand Down Expand Up @@ -204,7 +204,7 @@ private void populateSelector(String table, Selector selector) throws IOExceptio
if (blurIndex == null) {
throw new BlurException("Shard [" + shardName + "] is not being servered by this shardserver.", null);
}
IndexReader reader = blurIndex.getIndexReader(!selector.allowStaleData);
IndexReader reader = blurIndex.getIndexReader();
try {
IndexSearcher searcher = new IndexSearcher(reader);
BooleanQuery query = new BooleanQuery();
Expand Down Expand Up @@ -295,7 +295,7 @@ public BlurResultIterable query(final String table, final BlurQuery blurQuery, A
Filter postFilter = QueryParserUtil.parseFilter(table, simpleQuery.postSuperFilter, true, analyzer, _filterCache);
Query userQuery = QueryParserUtil.parseQuery(simpleQuery.queryStr, simpleQuery.superQueryOn, analyzer, postFilter, preFilter, getScoreType(simpleQuery.type));
Query facetedQuery = getFacetedQuery(blurQuery, userQuery, facetedCounts, analyzer);
call = new SimpleQueryParallelCall(running, table, status, _indexServer, facetedQuery, blurQuery.selector, !blurQuery.allowStaleData, _blurMetrics);
call = new SimpleQueryParallelCall(running, table, status, _indexServer, facetedQuery, blurQuery.selector, _blurMetrics);
} else {
Query query = getQuery(blurQuery.expertQuery);
Filter filter = getFilter(blurQuery.expertQuery);
Expand All @@ -306,7 +306,7 @@ public BlurResultIterable query(final String table, final BlurQuery blurQuery, A
userQuery = query;
}
Query facetedQuery = getFacetedQuery(blurQuery, userQuery, facetedCounts, analyzer);
call = new SimpleQueryParallelCall(running, table, status, _indexServer, facetedQuery, blurQuery.selector, !blurQuery.allowStaleData, _blurMetrics);
call = new SimpleQueryParallelCall(running, table, status, _indexServer, facetedQuery, blurQuery.selector, _blurMetrics);
}
MergerBlurResultIterable merger = new MergerBlurResultIterable(blurQuery);
return ForkJoin.execute(_executor, blurIndexes.entrySet(), call, new Cancel() {
Expand Down Expand Up @@ -490,7 +490,7 @@ public long recordFrequency(final String table, final String columnFamily, final
@Override
public Long call(Entry<String, BlurIndex> input) throws Exception {
BlurIndex index = input.getValue();
IndexReader reader = index.getIndexReader(true);
IndexReader reader = index.getIndexReader();
try {
return recordFrequency(reader, columnFamily, columnName, value);
} finally {
Expand Down Expand Up @@ -523,7 +523,7 @@ public List<String> terms(final String table, final String columnFamily, final S
@Override
public List<String> call(Entry<String, BlurIndex> input) throws Exception {
BlurIndex index = input.getValue();
IndexReader reader = index.getIndexReader(true);
IndexReader reader = index.getIndexReader();
try {
return terms(reader, columnFamily, columnName, startWith, size);
} finally {
Expand Down Expand Up @@ -588,7 +588,7 @@ public Schema schema(String table) throws IOException {
schema.columnFamilies = new TreeMap<String, Set<String>>();
Map<String, BlurIndex> blurIndexes = _indexServer.getIndexes(table);
for (BlurIndex blurIndex : blurIndexes.values()) {
IndexReader reader = blurIndex.getIndexReader(true);
IndexReader reader = blurIndex.getIndexReader();
try {
Collection<String> fieldNames = reader.getFieldNames(FieldOption.ALL);
for (String fieldName : fieldNames) {
Expand Down Expand Up @@ -759,19 +759,17 @@ public static class SimpleQueryParallelCall implements ParallelCall<Entry<String
private IndexServer _indexServer;
private Query _query;
private Selector _selector;
private boolean _forceRefresh;
private BlurMetrics _blurMetrics;
private AtomicBoolean _running;

public SimpleQueryParallelCall(AtomicBoolean running, String table, QueryStatus status, IndexServer indexServer, Query query, Selector selector, boolean forceRefresh,
public SimpleQueryParallelCall(AtomicBoolean running, String table, QueryStatus status, IndexServer indexServer, Query query, Selector selector,
BlurMetrics blurMetrics) {
_running = running;
_table = table;
_status = status;
_indexServer = indexServer;
_query = query;
_selector = selector;
_forceRefresh = forceRefresh;
_blurMetrics = blurMetrics;
}

Expand All @@ -781,7 +779,7 @@ public BlurResultIterable call(Entry<String, BlurIndex> entry) throws Exception
IndexReader reader = null;
try {
BlurIndex index = entry.getValue();
reader = index.getIndexReader(_forceRefresh);
reader = index.getIndexReader();
String shard = entry.getKey();
IndexSearcher searcher = new IndexSearcher(reader);
searcher.setSimilarity(_indexServer.getSimilarity(_table));
Expand Down
Expand Up @@ -49,7 +49,7 @@ public long getRecordCount(String table) throws IOException {
indexCount = new IndexCount();
indexCounts.counts.put(shard, indexCount);
}
indexReader = index.getValue().getIndexReader(false);
indexReader = index.getValue().getIndexReader();
if (!isValid(indexCount,indexReader)) {
indexCount.count = indexReader.numDocs();
indexCount.version = indexReader.getVersion();
Expand Down Expand Up @@ -93,7 +93,7 @@ public long getRowCount(String table) throws IOException {
indexCount = new IndexCount();
indexCounts.counts.put(shard, indexCount);
}
indexReader = index.getValue().getIndexReader(false);
indexReader = index.getValue().getIndexReader();
if (!isValid(indexCount,indexReader)) {
indexCount.count = getRowCount(indexReader);
indexCount.version = indexReader.getVersion();
Expand Down
Expand Up @@ -315,7 +315,7 @@ private void warmup() {

private void updateMetrics(BlurMetrics blurMetrics, Map<String, BlurIndex> indexes, AtomicLong segmentCount, AtomicLong indexMemoryUsage) throws IOException {
for (BlurIndex index : indexes.values()) {
IndexReader reader = index.getIndexReader(false);
IndexReader reader = index.getIndexReader();
try {
IndexReader[] readers = reader.getSequentialSubReaders();
if (readers != null) {
Expand Down Expand Up @@ -558,7 +558,7 @@ private BlurIndex openShard(String table, String shard) throws IOException {
}

private BlurIndex warmUp(BlurIndex index, String table, String shard) throws IOException {
final IndexReader reader = index.getIndexReader(true);
final IndexReader reader = index.getIndexReader();
warmUpAllSegments(reader);
_warmup.warmBlurIndex(table, shard, reader, index.isClosed(), new ReleaseReader() {
@Override
Expand Down
Expand Up @@ -58,18 +58,9 @@ public BlurResultIterableClient(Blur.Client client, String table, BlurQuery quer
private void performSearch() {
try {
long cursor = _remoteFetchCount * _batch;
BlurQuery blurQuery = new BlurQuery(_originalQuery.simpleQuery, _originalQuery.expertQuery, _originalQuery.facets, null, _originalQuery.allowStaleData,
BlurQuery blurQuery = new BlurQuery(_originalQuery.simpleQuery, _originalQuery.expertQuery, _originalQuery.facets, null, false,
_originalQuery.useCacheIfPresent, cursor, _remoteFetchCount, _originalQuery.minimumNumberOfResults, _originalQuery.maxQueryTime, _originalQuery.uuid,
_originalQuery.userContext, _originalQuery.cacheResult, _originalQuery.startTime, _originalQuery.modifyFileCaches);

// BlurQuery blurQuery = new BlurQuery(_originalQuery.simpleQuery,
// _originalQuery.expertQuery, cursor,
// _fetchCount, _originalQuery.minimumNumberOfResults,
// _originalQuery.maxQueryTime,
// _originalQuery.uuid, _originalQuery.userId, false,
// _originalQuery.facets, null,
// _originalQuery.startTime, false, _originalQuery.allowStaleData);

_results = _client.query(_table, blurQuery);
addFacets();
_totalResults = _results.totalResults;
Expand Down
Expand Up @@ -76,10 +76,7 @@ public void refresh() throws IOException {
}

@Override
public IndexReader getIndexReader(boolean forceRefresh) throws IOException {
if (forceRefresh) {
refresh();
}
public IndexReader getIndexReader() throws IOException {
IndexReader indexReader = _indexReaderRef.get();
indexReader.incRef();
return indexReader;
Expand Down
Expand Up @@ -13,7 +13,7 @@ public abstract class BlurIndex {

public abstract void deleteRow(boolean waitToBeVisible, boolean wal, String rowId) throws IOException;

public abstract IndexReader getIndexReader(boolean forceRefresh) throws IOException;
public abstract IndexReader getIndexReader() throws IOException;

public abstract void close() throws IOException;

Expand Down
Expand Up @@ -181,7 +181,7 @@ public void deleteRow(boolean waitToBeVisible, boolean wal, String rowId) throws
}

@Override
public IndexReader getIndexReader(boolean forceRefresh) throws IOException {
public IndexReader getIndexReader() throws IOException {
IndexSearcher searcher = _manager.acquire();
return searcher.getIndexReader();
}
Expand Down
Expand Up @@ -30,6 +30,7 @@ public void onEviction(QueryCacheKey key, QueryCacheEntry value) {
LOG.debug("Cache [" + _name + "] key [" + key + "] value [" + value + "] evicted.");
}

@SuppressWarnings("deprecation")
public static QueryCacheKey getNormalizedBlurQueryKey(String table, BlurQuery blurQuery) {
BlurQuery newBlurQuery = new BlurQuery(blurQuery);
newBlurQuery.allowStaleData = false;
Expand Down
Expand Up @@ -24,7 +24,6 @@
import com.nearinfinity.blur.lucene.LuceneConstant;
import com.nearinfinity.blur.thrift.generated.Record;
import com.nearinfinity.blur.thrift.generated.RecordMutation;
import com.nearinfinity.blur.thrift.generated.Row;
import com.nearinfinity.blur.thrift.generated.RowMutation;

public class BlurUtilsTest {
Expand Down

0 comments on commit 0aa6a01

Please sign in to comment.