15.07.2016 Views

MARKLOGIC SERVER

Inside-MarkLogic-Server

Inside-MarkLogic-Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

LIFECYCLE OF A QUERY IN A CLUSTER<br />

Earlier we covered the lifecycle of a query. Let's do that again but with an eye toward<br />

how the E-nodes and D-nodes communicate and where the caches fit in.<br />

Let's assume that we're running the same cts:search() as before—the one that<br />

liked cats and puppy dogs but didn't like fish. In order to gather term lists, the E-node<br />

pushes a representation of the search expression to each forest in the database in<br />

parallel. Each forest on a D-node returns an iterator to its score-sorted results. All the<br />

term list selection and intersection happen on the D-node. Locks would happen on the<br />

D-node side as well, but since this is a read-only query, it runs lock-free.<br />

The E-node selects from the iterators holding the highest scores and pulls from them<br />

to locate the most relevant results from across the database. Over the wire, it receives<br />

fragment IDs along with score data. When the E-node retrieves the actual fragment<br />

associated with the fragment ID, it looks first to its own Expanded Tree Cache. If it<br />

can't find it, it requests the fragment from the D-node from which the fragment ID<br />

came. The D-node looks in its own Compressed Tree Cache for the fragment, and if<br />

it's not in that cache either, it pulls it off disk.<br />

At this point, the E-node may filter the fragment. It looks at its tree structure and<br />

checks if it truly matches the search constraints. Only if it survives the filtering does it<br />

proceed to the return clause and become a generated result. If the query is running as<br />

unfiltered, no checking occurs.<br />

52

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!