Skip to content

Commit

Permalink
Publishing of huge tree fails #10623
Browse files Browse the repository at this point in the history
  • Loading branch information
vbradnitski authored and rymsha committed Aug 6, 2024
1 parent 325fb61 commit 3d52e53
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ private ElasticsearchQuery createQuery()
final QueryBuilder idFilterBuilder =
new FilterBuilderFactory( SearchQueryFieldNameResolver.INSTANCE ).create( Filters.from( idFilter ) );

return ElasticsearchQuery.create()
.query( QueryBuilders.boolQuery().must( idFilterBuilder ) )
return ElasticsearchQuery.create().query( QueryBuilders.boolQuery().filter( idFilterBuilder ) )
.addIndexName( copyRequest.getStorageSource().getStorageName().getName() )
.addIndexType( copyRequest.getStorageSource().getStorageType().getName() )
.size( copyRequest.getNodeIds().size() )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.enonic.xp.core.node;

import java.util.concurrent.TimeUnit;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.google.common.base.Stopwatch;

import com.enonic.xp.core.AbstractNodeTest;
import com.enonic.xp.node.CreateNodeParams;
import com.enonic.xp.node.FindNodesByQueryResult;
Expand All @@ -14,8 +18,11 @@
import com.enonic.xp.node.PushNodeEntry;
import com.enonic.xp.node.PushNodesResult;
import com.enonic.xp.node.RefreshMode;
import com.enonic.xp.node.ResolveSyncWorkResult;
import com.enonic.xp.node.UpdateNodeParams;
import com.enonic.xp.repo.impl.node.FindNodesByQueryCommand;
import com.enonic.xp.repo.impl.node.PushNodesCommand;
import com.enonic.xp.repo.impl.node.ResolveSyncWorkCommand;
import com.enonic.xp.security.acl.AccessControlEntry;
import com.enonic.xp.security.acl.AccessControlList;
import com.enonic.xp.security.acl.Permission;
Expand Down Expand Up @@ -438,6 +445,43 @@ public void push_with_capital_node_id()
assertNotNull( prodNode );
}

@Test
void push_more_than_1024_nodes_at_once()
{
final Node rootNode = createNodeSkipVerification( CreateNodeParams.create().name( "rootNode" ).parent( NodePath.ROOT ).build() );

createNodes( rootNode, 10, 3, 1 );

refresh();

final ResolveSyncWorkResult syncWork = ResolveSyncWorkCommand.create()
.nodeId( rootNode.id() )
.target( WS_OTHER )
.indexServiceInternal( this.indexServiceInternal )
.storageService( this.storageService )
.searchService( this.searchService )
.build()
.execute();

final Stopwatch started = Stopwatch.createStarted();

final PushNodesResult result = PushNodesCommand.create()
.ids( syncWork.getNodeComparisons().getNodeIds() )
.target( WS_OTHER )
.indexServiceInternal( this.indexServiceInternal )
.storageService( this.storageService )
.searchService( this.searchService )
.build()
.execute();

started.stop();

final long elapsed = started.elapsed( TimeUnit.SECONDS );
final int number = result.getSuccessfulEntries().size();

System.out.println( "Pushed : " + number + " in " + started + ", " + ( elapsed == 0 ? "n/a" : ( number / elapsed ) + "/s" ) );
}

private Node getNodeByPathInOther( final NodePath nodePath )
{
return ctxOther().callWith( () -> getNodeByPath( nodePath ) );
Expand Down

0 comments on commit 3d52e53

Please sign in to comment.