let me guess. You have upgraded or started using mysql 4.1. This version
returns an optimized resultset which filters out duplicate nodes.
I have patched a mmbase 1.6 project once for this, but I didn't commit
in in mmbase 1.7, because we don't have the intenton to release a new
mmbase version.
I changed in MMObjectBuilder the following method
Notice that this is a patch for mmbase 1.6
/**
* Convert virtual nodes to real nodes based on their otype
*
* Normally a multirelations-search will return virtual nodes.
These nodes
* will only contain values which where specified in the field-vector.
* This method will make real nodes of those virtual nodes.
*
* @param List containing virtual nodes
* @return List containing real nodes
* @since MMBase-1.6.2
*/
public List getNodes(List virtuals) {
List result = new ArrayList();
StringBuffer numbers = new StringBuffer();
boolean first = true;
List virtualNumbers = new ArrayList();
Iterator i = virtuals.iterator();
while(i.hasNext()) {
MMObjectNode node = (MMObjectNode) i.next();
Integer number = new Integer(node.getIntValue("number"));
if (!virtualNumbers.contains(number)) {
virtualNumbers.add(number);
// check if this node is already in cache
if(nodeCache.containsKey(number)) {
result.add(nodeCache.get(number));
// else seek it with a search on builder in db
} else {
if (first) {
first = false;
} else {
numbers.append(",");
}
numbers.append(number);
}
if(numbers.length() > MAX_QUERY_SIZE) {
result.addAll(basicSearch("SELECT " +
getNonByteArrayFields() + " FROM " + getFullTableName() + " WHERE
number in (" + numbers.toString() + ")"));
numbers = new StringBuffer();
first = true;
}
}
}
// now that we have a comma seperated string of numbers, we can
// the search with a where-clause containing this list
if(! numbers.toString().equals("")) {
result.addAll(basicSearch("SELECT " +
getNonByteArrayFields() + " FROM " + getFullTableName() + " WHERE number
in (" + numbers.toString() + ")"));
} // else everything from cache
// check that we didnt loose any nodes
// Java 1.4
// assert(virtuals.size() == result.size());
// Below Java 1.4
if(virtualNumbers.size() != result.size()) {
log.error("We lost a few nodes during conversion from
virtualsnodes("+virtualNumbers.size()+") to realnodes("+result.size()+")");
StringBuffer vNumbers = new StringBuffer();
for (int j = 0; j < virtualNumbers.size(); j++) {
vNumbers.append(virtualNumbers.get(j)).append(" ");
}
log.error("Virtual node numbers: " + vNumbers.toString());
StringBuffer rNumbers = new StringBuffer();
for (int j = 0; j < result.size(); j++) {
int resultNumber = ((MMObjectNode)
result.get(j)).getIntValue("number");
rNumbers.append(resultNumber).append(" ");
}
log.error("Real node numbers: " + rNumbers.toString());
}
return result;
}
And in MMObjectNode.
/**
* Loop through the virtuals vector, group all same nodes based on
parent and fetch the real nodes from those parents
*
* @param Vector of virtual nodes (only type.number and type.otype
fields are set)
* @param type, needed to retreive the otype, which is set in node
as type + ".otype"
* @returns List of real nodes
*
* @see getRelatedNodes(String type)
* @since MMBase-1.6.2
*/
private List getRealNodes(Vector virtuals, String type) {
log.debug("getRealNodes("+virtuals.size()+","+type+"):
Converting "+virtuals.size()+" virtual nodes to real MMObjectNodes");
List result = new ArrayList();
MMObjectNode node = null;
MMObjectNode convert = null;
Enumeration e = virtuals.elements();
List list = new ArrayList();
int otype = -1;
int ootype = -1;
List virtualNumbers = new ArrayList();
// fill the list
while(e.hasMoreElements()) {
node = (MMObjectNode)e.nextElement();
Integer number = node.getIntegerValue(type + ".number");
if (!virtualNumbers.contains(number)) {
virtualNumbers.add(number);
otype = node.getIntValue(type + ".otype");
// convert the nodes of type ootype to real numbers
if(otype != ootype) {
// if we have nodes return real values
if(ootype != -1) {
result.addAll(getRealNodesFromBuilder(list,
ootype));
list = new ArrayList();
}
ootype = otype;
}
// convert current node type.number and type.otype to
number and otype
convert = new
MMObjectNode(parent.mmb.getMMObject(parent.mmb.TypeDef.getValue(otype)));
// parent needs to be set or else mmbase does nag nag
nag on a setValue()
convert.setValue("number", node.getValue(type +
".number"));
convert.setValue("otype", otype);
list.add(convert);
}
// first and only list or last list, return real values
if(!e.hasMoreElements()) {
// log.debug("subconverting last "+list.size()+" nodes
of type("+otype+")");
result.addAll(getRealNodesFromBuilder(list, otype));
}
}
// check that we didnt loose any nodes
// Java 1.4
// assert(virtuals.size() == result.size());
// Below Java 1.4
if(virtualNumbers.size() != result.size()) {
log.error("We lost a few nodes during conversion from
virtualsnodes("+virtualNumbers.size()+") to realnodes("+result.size()+")");
StringBuffer vNumbers = new StringBuffer();
for (int j = 0; j < virtualNumbers.size(); j++) {
vNumbers.append(virtualNumbers.get(j)).append(" ");
}
log.error("Virtual node numbers: " + vNumbers.toString());
StringBuffer rNumbers = new StringBuffer();
for (int j = 0; j < result.size(); j++) {
int resultNumber = ((MMObjectNode)
result.get(j)).getIntValue("number");
rNumbers.append(resultNumber).append(" ");
}
log.error("Real node numbers: " + rNumbers.toString());
}
return result;
}
Arjen Roodselaar wrote:
Hi all,
I'm one of the current active Didactor application administrators. While
updating an older installation of this software to the latest version I
noticed the following messages in mmbase.log:
2006-03-09 22:36:04,144 INFO org.mmbase.module.Module info.66 - Starting
module sendmail
2006-03-09 22:36:04,145 INFO org.mmbase.module.Module info.66 - Starting
module jdbc
2006-03-09 22:36:04,145 INFO org.mmbase.module.Module info.66 - Starting
module upload
2006-03-09 22:36:04,147 INFO org.mmbase.servlet.MMBaseServlet setMMBase.156
- MMBase servlets are ready to receive requests
2006-03-09 22:36:04,230 INFO mmbob.util.fieldprocessors.PostingPreProcessor
<init>.? - init postprocessor
2006-03-09 22:36:19,284 INFO bridge.jsp.taglib.ContextReferrerTag
setPageContext.80 - Using EVAL_BODY_BUFFERED
2006-03-09 22:36:45,412 ERROR mmbase.module.core.MMObjectNode
getRealNodes.1554 - We lost a few nodes during conversion from
virtualnodes(6) to realnodes(5)
2006-03-09 22:36:48,908 ERROR mmbase.module.core.MMObjectNode
getRealNodes.1554 - We lost a few nodes during conversion from
virtualnodes(6) to realnodes(5)
2006-03-09 22:36:50,046 ERROR mmbase.module.core.MMObjectNode
getRealNodes.1554 - We lost a few nodes during conversion from
virtualnodes(6) to realnodes(5)
2006-03-09 22:36:53,609 ERROR mmbase.module.core.MMObjectNode
getRealNodes.1554 - We lost a few nodes during conversion from
virtualnodes(6) to realnodes(5)
2006-03-09 22:36:54,378 ERROR mmbase.module.core.MMObjectNode
getRealNodes.1554 - We lost a few nodes during conversion from
virtualnodes(6) to realnodes(5)
2006-03-09 22:36:54,945 ERROR mmbase.module.core.MMObjectNode
getRealNodes.1554 - We lost a few nodes during conversion from
virtualnodes(6) to realnodes(5)
2006-03-09 22:37:18,467 WARN mmbase.module.core.ClusterBuilder
addRelationDirections.1656 - No relation defined between educations and
images using RelationStep(tablename:pos2rel, alias:pos2rel, nodes:[],
dir:destination, role:51130) with direction(s) BOTH. Searching in
'destination' direction now, but perhaps the query should be fixed, because
this should always result nothing.
2006-03-09 22:37:18,930 WARN mmbase.module.core.ClusterBuilder
addRelationDirections.1656 - No relation defined between learnblocks and
images using RelationStep(tablename:pos2rel, alias:pos2rel, nodes:[],
dir:destination, role:51130) with direction(s) BOTH. Searching in
'destination' direction now, but perhaps the query should be fixed, because
this should always result nothing.
The ones I'm concerned about are about the lost nodes. Unfortunately the
developers working on this application have not seen this error before and
have no idea of the impact of this error. Does anyone in the MMbase community
know what the impact of this error is/will be and how we could possibly fix
this.
While I'm at it; does anybody know what the ClusterBuilder error means
exactly, whether this is a code of a configuration problem, and how this can
be fixed?
Some environment information:
Sun Java 1.4.2.10
Tomcat 5.5.15
MMbase 1.7.3-final 20050107
If more information is needed (I'm not sure if I should supply more) feel free
to ask!
Thanks in advance!
Arjen Roodselaar
------------------------------------------------------------------------
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers