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
|
||||
public void create(Create create) throws EngineException {
|
||||
// no-op
|
||||
logger.trace("skipping CREATE on shadow engine");
|
||||
throw new UnsupportedOperationException("create operation not allowed on shadow engine");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void index(Index index) throws EngineException {
|
||||
// no-op
|
||||
logger.trace("skipping INDEX on shadow engine");
|
||||
throw new UnsupportedOperationException("index operation not allowed on shadow engine");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Delete delete) throws EngineException {
|
||||
// no-op
|
||||
logger.trace("skipping DELETE on shadow engine");
|
||||
throw new UnsupportedOperationException("delete operation not allowed on shadow engine");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(DeleteByQuery delete) throws EngineException {
|
||||
// no-op
|
||||
logger.trace("skipping DELETE-BY-QUERY on shadow engine");
|
||||
throw new UnsupportedOperationException("delete-by-query operation not allowed on shadow engine");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -475,7 +475,10 @@ public class ShadowEngineTests extends ElasticsearchLuceneTestCase {
|
|||
ParseContext.Document document = testDocumentWithTextField();
|
||||
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);
|
||||
try {
|
||||
replicaEngine.create(new Engine.Create(null, newUid("1"), doc));
|
||||
fail("should have thrown an exception");
|
||||
} catch (UnsupportedOperationException e) {}
|
||||
replicaEngine.refresh("test");
|
||||
|
||||
// its not there...
|
||||
|
@ -491,7 +494,10 @@ public class ShadowEngineTests extends ElasticsearchLuceneTestCase {
|
|||
document = testDocument();
|
||||
document.add(new TextField("value", "test1", Field.Store.YES));
|
||||
doc = testParsedDocument("1", "1", "test", null, -1, -1, document, B_1, false);
|
||||
try {
|
||||
replicaEngine.index(new Engine.Index(null, newUid("1"), doc));
|
||||
fail("should have thrown an exception");
|
||||
} catch (UnsupportedOperationException e) {}
|
||||
replicaEngine.refresh("test");
|
||||
|
||||
// its still not there...
|
||||
|
@ -524,7 +530,10 @@ public class ShadowEngineTests extends ElasticsearchLuceneTestCase {
|
|||
getResult.release();
|
||||
|
||||
// try to delete it on the replica
|
||||
try {
|
||||
replicaEngine.delete(new Engine.Delete("test", "1", newUid("1")));
|
||||
fail("should have thrown an exception");
|
||||
} catch (UnsupportedOperationException e) {}
|
||||
replicaEngine.flush();
|
||||
replicaEngine.refresh("test");
|
||||
primaryEngine.refresh("test");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue