Hi Luca,
well I thought going straight to the index would be faster?! but
anyways I did change to go via SQL layer... still same error happens
(I just reverted to local for now so I can continue with my
requirement)...
I also tried to apply the suggestions you gave me but no success, and
this is what is killing me at the moment actually, check this out...
I wanted to modify the agent with 2 fields to let me know how many
tweets in history and how many in total, but I get the version (db vs
yours) kinda error... so I created a new object just to store the
related agent and is totals but still same error happens (see
bellow)...
looks like after the third or fourth run of deletions
(db.removeCrmAgentTwitterEdge((ODocument)db.load(orid));//this method
only calls removeEdge from OGraphDatabase) it messes up the twiOut
edge adding this 0000 value in there...
here is the snippet of my last code (I've tried more then 10 different
combinations, from simplest to weirdest) even splitting up everything
in different documents, but no success:
===============
ORecordId orid = new ORecordId(), oridIdx;
ODocument agent, totals; Set<OIdentifiable> edges;
int amountInHistory, totalTweets, size, toDelete;
String rid;
db.declareIntent(new OIntentMassiveInsert());
//OIndex<ORecordId> agentIdx =
(OIndex<ORecordId>)db.getMetadata().getIndexManager().getIndex(SocialStorageConstants.CRM_AGENT_COUNT_HOLDER
+ "." + SocialStorageConstants.AGENT_FIELD_NAME);
for(Iterator<String> i = ags.iterator(); i.hasNext();) {
rid = i.next();
orid.reset();
orid.fromString(rid);
agent = db.load(orid);
List<ODocument> l = db.command(new
OSQLSynchQuery<ODocument>("SELECT FROM " +
SocialStorageConstants.CRM_AGENT_COUNT_HOLDER + " WHERE " +
SocialStorageConstants.AGENT_FIELD_NAME + " = '" + rid +
"'")).execute();
if(l == null || l.size() <= 0) {
// oridIdx= agentIdx.get(rid);
// if(oridIdx == null) {
totals =
db.newInstance(SocialStorageConstants.CRM_AGENT_COUNT_HOLDER);
totals.field(SocialStorageConstants.AGENT_FIELD_NAME,
rid);
} else {
// totals = (ODocument)oridIdx.getRecord();
totals = l.get(0);
}
amountInHistory =
NumberUtils.createInteger(ObjectUtils.toString(totals.field(SocialStorageConstants.TOTAL_TWEETS_HISTORY),
"0"));
edges = db.getCrmAgentTwitterEdges(agent);
size = edges.size();
toDelete = size - mediaLimit;
if(size > mediaLimit) {
if(log.isInfoEnabled()) {
log.info("Agent has exceed its media limit, moving
[" + toDelete + "] updates to history, agent is [" + agent + "]");
}
ODocument o, oo, status;
oo = db.newInstance();
int deleted = 0; ArrayList<String> removeLater = new
ArrayList<String>() /*avoids concurrent issues with the iterator*/;
for (OIdentifiable ii : edges) {//supposed to be order
from old to new
if(deleted++ >= toDelete) break;
o = (ODocument)ii.getRecord();
status = db.getInVertex(o);
removeLater.add(ii.getIdentity().toString());
//move link to
oo.reset();
oo.setClassName(SocialStorageConstants.CRM_AGENT_TO_TWITTER_UPDATE_HISTORY);
oo.field(SocialStorageConstants.AGENT_FIELD_NAME,
agent.getIdentity().toString());
oo.field("tweet",
status.getIdentity().toString());
oo.save();
if(log.isTraceEnabled()) {
log.trace("Removing edge [" + o + "] and
created history item [" + oo + "]");
}
}
// ORecordId rid = new ORecordId();
for(String s : removeLater) {
orid.reset();
orid.fromString(s);
db.removeCrmAgentTwitterEdge((ODocument)db.load(orid));
}
db.declareIntent(null);
amountInHistory += toDelete;//only get here if size >
limit
}
totalTweets = (size - toDelete) + amountInHistory;
totals.field(SocialStorageConstants.TOTAL_TWEETS,
totalTweets);
totals.field(SocialStorageConstants.TOTAL_TWEETS_HISTORY,
amountInHistory);
totals.save();
if(log.isDebugEnabled()) {
log.debug("Agent is now [" + agent + "] with totals ["
+ totals + "]");
}
}
=============================================
23:35:36,416 ERROR jobLauncherTaskExecutor-1 step.AbstractStep:212 -
Encountered an error executing the step
java.lang.IllegalArgumentException: Argument '0000' is not a RecordId
in form of string. Format must be: <cluster-id>:<cluster-position>
at
com.orientechnologies.orient.core.id.ORecordId.fromString(ORecordId.java:
234)
at
com.orientechnologies.orient.core.id.ORecordId.<init>(ORecordId.java:
59)
at
com.orientechnologies.orient.core.db.record.ORecordLazyList.lazyLoad(ORecordLazyList.java:
454)
at
com.orientechnologies.orient.core.db.record.ORecordLazyList.size(ORecordLazyList.java:
236)
at
com.orientechnologies.orient.core.db.record.ORecordLazySet.size(ORecordLazySet.java:
128)
at java.util.Collections$UnmodifiableCollection.size(Collections.java:
998)
at
com.beelgssource.core.batch.twitter.qualifier.CheckExceedCrmAgentTwitterEdgesTasklet.execute(CheckExceedCrmAgentTwitterEdgesTasklet.java:
72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:
309)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
183)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
150)
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:
131)
at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:
119)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
On Nov 15, 9:11 am, Luca Garulli <
l.garu...@gmail.com> wrote:
> Seems unaligned client and server version, but the problem could be on
> serialization of index expressions. By the way why you query the index
> directly?
>
> Lvc@
>
> On 14 November 2011 18:47, Rafael Fernandes <
luizraf...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I was passing the following: (select FLATTEN( rid ) from
> > index:SocialAccountsVertex.un where key = "RAFAEL FERNANDES")... which
> > now works...
>
> > but I just restarted the server and keep getting strange errors, just
> > like this one...
>
> > ========================== what I get in my client
> > ========================
> > 15:44:22,159 ERROR jobLauncherTaskExecutor-2 step.AbstractStep:212 -
> > Encountered an error executing the step
> > com.orientechnologies.orient.core.exception.OSerializationException:
> > Error on unmarshalling content. Class:
> > com.orientechnologies.orient.core.sql.query.OSQLSynchQuery
> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > Method)
> > at
>
> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcce ssorImpl.java:
> > 39)
> > at
>
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstru ctorAccessorImpl.java:
> > 27)
> > at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> > at
>
> > com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.creat eException(OChannelBinary.java:
> > 374)
> > at
>
> > com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.handl eStatus(OChannelBinary.java:
> > 330)
> > at
>
> > com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch .beginResponse(OChannelBinaryAsynch.java:
> > 83)
> > at
>
> > com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OSt orageRemote.java:
> > 1418)
>
> ...
>
> read more »