database - Titan index update takes too long -


even on empty database, creating index in titan 1.0 takes several minutes. time seems exact, suggests there unnecessary delay.

my question this: how shorten or eliminate amount of time titan takes reindex? conceptually, since no work being done time should minimal, not 4 minutes.

(n.b. have been pointed solution makes titan wait full delay without timing out. wrong solution - want eliminate delay entirely.)

the code i'm using setup database scratch is:

graph = ... local cassandra instance ... graph.tx().rollback()  // 1. check if index exists mgmt = graph.openmanagement() = mgmt.getgraphindex('byident') if(! i) {   // 1a. if index not exist, add   idkey = mgmt.getpropertykey('ident')   idkey = idkey ? idkey : mgmt.makepropertykey('ident').datatype(string.class).make()   mgmt.buildindex('byident', vertex.class).addkey(idkey).buildcompositeindex()   mgmt.commit()   graph.tx().commit()    mgmt  = graph.openmanagement()   idkey = mgmt.getpropertykey('ident')   idx   = mgmt.getgraphindex('byident')   // 1b. wait index availability   if ( idx.getindexstatus(idkey).equals(schemastatus.installed) ) {     mgmt.awaitgraphindexstatus(graph, 'byident').status(schemastatus.registered).call()   }   // 1c. reindex, though db empty.   mgmt.updateindex(mgmt.getgraphindex('byident'), schemaaction.reindex).get()   mgmt.commit()   mgmt.awaitgraphindexstatus(graph, 'byident').status(schemastatus.enabled).call() } else { mgmt.commit() } 

it appears updateindex...reindex call blocks till timeout. known problem or worksformewon'tfix? doing wrong?

edit: disabling reindex, discussed in comments not fix because index not seem become active. see:

warn  com.thinkaurelius.titan.graphdb.transaction.standardtitantx  - query requires iterating on vertices [(myindexedkey = somevalue)]. better performance, use indexes 

the time delay is/was entirely unnecessary , due misuse of titan (though pattern appear in titan 1.0.0 documentation chapter 28).

do not block in transaction!

instead of:

  mgmt  = graph.openmanagement()   idkey = mgmt.getpropertykey('ident')   idx   = mgmt.getgraphindex('byident')   // 1b. wait index availability   if ( idx.getindexstatus(idkey).equals(schemastatus.installed) ) {     mgmt.awaitgraphindexstatus(graph, 'byident').status(schemastatus.registered).call()   } 

consider:

  mgmt  = graph.openmanagement()   idkey = mgmt.getpropertykey('ident')   idx   = mgmt.getgraphindex('byident')   // wait index availability   if ( idx.getindexstatus(idkey).equals(schemastatus.installed) ) {     mgmt.commit()     mgmt.awaitgraphindexstatus(graph, 'byident').status(schemastatus.registered).call()   } else { mgmt.commit() } 

use enable_index

not: mgmt.updateindex(mgmt.getgraphindex('byident'), schemaaction.reindex).get()

rather: mgmt.updateindex(mgmt.getgraphindex('byident'),schemaaction.enable_index).get()


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo