mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-30 02:13:33 -04:00
throw UnsupportedOperationException on write operations in ShadowEngine
This commit is contained in:
parent
740c28dd9e
commit
2ae80f9689
2 changed files with 16 additions and 11 deletions
|
@ -102,26 +102,22 @@ public class ShadowEngine extends Engine {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(Create create) throws EngineException {
|
public void create(Create create) throws EngineException {
|
||||||
// no-op
|
throw new UnsupportedOperationException("create operation not allowed on shadow engine");
|
||||||
logger.trace("skipping CREATE on shadow engine");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void index(Index index) throws EngineException {
|
public void index(Index index) throws EngineException {
|
||||||
// no-op
|
throw new UnsupportedOperationException("index operation not allowed on shadow engine");
|
||||||
logger.trace("skipping INDEX on shadow engine");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Delete delete) throws EngineException {
|
public void delete(Delete delete) throws EngineException {
|
||||||
// no-op
|
throw new UnsupportedOperationException("delete operation not allowed on shadow engine");
|
||||||
logger.trace("skipping DELETE on shadow engine");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(DeleteByQuery delete) throws EngineException {
|
public void delete(DeleteByQuery delete) throws EngineException {
|
||||||
// no-op
|
throw new UnsupportedOperationException("delete-by-query operation not allowed on shadow engine");
|
||||||
logger.trace("skipping DELETE-BY-QUERY on shadow engine");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -475,7 +475,10 @@ public class ShadowEngineTests extends ElasticsearchLuceneTestCase {
|
||||||
ParseContext.Document document = testDocumentWithTextField();
|
ParseContext.Document document = testDocumentWithTextField();
|
||||||
document.add(new Field(SourceFieldMapper.NAME, B_1.toBytes(), SourceFieldMapper.Defaults.FIELD_TYPE));
|
document.add(new Field(SourceFieldMapper.NAME, B_1.toBytes(), SourceFieldMapper.Defaults.FIELD_TYPE));
|
||||||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, document, B_1, false);
|
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, document, B_1, false);
|
||||||
replicaEngine.create(new Engine.Create(null, newUid("1"), doc));
|
try {
|
||||||
|
replicaEngine.create(new Engine.Create(null, newUid("1"), doc));
|
||||||
|
fail("should have thrown an exception");
|
||||||
|
} catch (UnsupportedOperationException e) {}
|
||||||
replicaEngine.refresh("test");
|
replicaEngine.refresh("test");
|
||||||
|
|
||||||
// its not there...
|
// its not there...
|
||||||
|
@ -491,7 +494,10 @@ public class ShadowEngineTests extends ElasticsearchLuceneTestCase {
|
||||||
document = testDocument();
|
document = testDocument();
|
||||||
document.add(new TextField("value", "test1", Field.Store.YES));
|
document.add(new TextField("value", "test1", Field.Store.YES));
|
||||||
doc = testParsedDocument("1", "1", "test", null, -1, -1, document, B_1, false);
|
doc = testParsedDocument("1", "1", "test", null, -1, -1, document, B_1, false);
|
||||||
replicaEngine.index(new Engine.Index(null, newUid("1"), doc));
|
try {
|
||||||
|
replicaEngine.index(new Engine.Index(null, newUid("1"), doc));
|
||||||
|
fail("should have thrown an exception");
|
||||||
|
} catch (UnsupportedOperationException e) {}
|
||||||
replicaEngine.refresh("test");
|
replicaEngine.refresh("test");
|
||||||
|
|
||||||
// its still not there...
|
// its still not there...
|
||||||
|
@ -524,7 +530,10 @@ public class ShadowEngineTests extends ElasticsearchLuceneTestCase {
|
||||||
getResult.release();
|
getResult.release();
|
||||||
|
|
||||||
// try to delete it on the replica
|
// try to delete it on the replica
|
||||||
replicaEngine.delete(new Engine.Delete("test", "1", newUid("1")));
|
try {
|
||||||
|
replicaEngine.delete(new Engine.Delete("test", "1", newUid("1")));
|
||||||
|
fail("should have thrown an exception");
|
||||||
|
} catch (UnsupportedOperationException e) {}
|
||||||
replicaEngine.flush();
|
replicaEngine.flush();
|
||||||
replicaEngine.refresh("test");
|
replicaEngine.refresh("test");
|
||||||
primaryEngine.refresh("test");
|
primaryEngine.refresh("test");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue