diff --git a/orientdb/README.md b/orientdb/README.md index f0b0693dacd9325bb7f0961a69471077346e7dc8..ba79159fa520653cf768efb2d15b89aadcd4fe47 100644 --- a/orientdb/README.md +++ b/orientdb/README.md @@ -51,6 +51,12 @@ See the next section for the list of configuration parameters for OrientDB. * ```orientdb.newdb``` - Overwrite the database if it already exists. * Only effects the ```load``` phase. * Default: ```false``` +* ```orientdb.intent``` - Declare an Intent to the database. + * This is an optimization feature provided by OrientDB: http://orientdb.com/docs/2.1/Performance-Tuning.html#massive-insertion + * Possible values are: + * massiveinsert + * massiveread + * nocache * ```orientdb.remote.storagetype``` - Storage type of the database on remote server * This is only required if using a ```remote:``` connection url diff --git a/orientdb/src/main/java/com/yahoo/ycsb/db/OrientDBClient.java b/orientdb/src/main/java/com/yahoo/ycsb/db/OrientDBClient.java index 5d576e3ff48ed026b5c76661c4be03f375ee6cc6..525b2a9532da9e1a628d72f27c5230758afb75a7 100644 --- a/orientdb/src/main/java/com/yahoo/ycsb/db/OrientDBClient.java +++ b/orientdb/src/main/java/com/yahoo/ycsb/db/OrientDBClient.java @@ -27,6 +27,8 @@ import com.orientechnologies.orient.core.dictionary.ODictionary; import com.orientechnologies.orient.core.exception.ODatabaseException; import com.orientechnologies.orient.core.index.OIndexCursor; import com.orientechnologies.orient.core.intent.OIntentMassiveInsert; +import com.orientechnologies.orient.core.intent.OIntentMassiveRead; +import com.orientechnologies.orient.core.intent.OIntentNoCache; import com.orientechnologies.orient.core.record.ORecord; import com.orientechnologies.orient.core.record.impl.ODocument; import com.yahoo.ycsb.ByteIterator; @@ -67,10 +69,16 @@ public class OrientDBClient extends DB { private static final String STORAGE_TYPE_PROPERTY = "orientdb.remote.storagetype"; + private static final String INTENT_PROPERTY = "orientdb.intent"; + private static final String INTENT_PROPERTY_DEFAULT = ""; + private static final String DO_TRANSACTIONS_PROPERTY = "dotransactions"; private static final String DO_TRANSACTIONS_PROPERTY_DEFAULT = "true"; private static final String ORIENTDB_DOCUMENT_TYPE = "document"; + private static final String ORIENTDB_MASSIVEINSERT = "massiveinsert"; + private static final String ORIENTDB_MASSIVEREAD = "massiveread"; + private static final String ORIENTDB_NOCACHE = "nocache"; private final Logger log = LoggerFactory.getLogger(getClass()); @@ -83,6 +91,7 @@ public class OrientDBClient extends DB { String password = props.getProperty(PASSWORD_PROPERTY, PASSWORD_PROPERTY_DEFAULT); Boolean newdb = Boolean.parseBoolean(props.getProperty(NEWDB_PROPERTY, NEWDB_PROPERTY_DEFAULT)); String remoteStorageType = props.getProperty(STORAGE_TYPE_PROPERTY); + String intent = props.getProperty(INTENT_PROPERTY, INTENT_PROPERTY_DEFAULT); Boolean dotransactions = Boolean.parseBoolean( props.getProperty(DO_TRANSACTIONS_PROPERTY, DO_TRANSACTIONS_PROPERTY_DEFAULT)); @@ -144,7 +153,16 @@ public class OrientDBClient extends DB { db.getMetadata().getSchema().createClass(CLASS); } - db.declareIntent(new OIntentMassiveInsert()); + if (intent.equals(ORIENTDB_MASSIVEINSERT)) { + log.info("Declaring intent of MassiveInsert."); + db.declareIntent(new OIntentMassiveInsert()); + } else if (intent.equals(ORIENTDB_MASSIVEREAD)) { + log.info("Declaring intent of MassiveRead."); + db.declareIntent(new OIntentMassiveRead()); + } else if (intent.equals(ORIENTDB_NOCACHE)) { + log.info("Declaring intent of NoCache."); + db.declareIntent(new OIntentNoCache()); + } } @Override