: > lucene, something has to "mark" the segements as deleted in order for them
        ...
: Note, it doesn't mark the "segment", it marks the "document".

correct, typo on my part -- sorry.

: > The disatisfaction you expressed with this approach confuses me...
: >
: Really ?
: If you have many expiring docs

...you didn't seem to finish that thought so i'm still not really sure 
what your're suggestion is in terms of why an alternative would be more 
efficient.

: "For example, with the configuration below the
: DocExpirationUpdateProcessorFactory will create a timer thread that wakes
: up every 30 seconds. When the timer triggers, it will execute a
: *deleteByQuery* command to *remove any documents* with a value in the
: press_release_expiration_date field value that is in the past "

that document is describing a *logical* deletion as i mentioned before -- 
the documents are "removed" in the sense that they are flaged "not alive" 
won't be included in future searches, but the data still lives in the 
segements on disk until a future merge.  (That is end user documentation, 
focusing on the effects as percieved by clients -- the concept of "delete" 
from a low level storage implementation is a much more involved concept 
that affects any discussion of "deleting" documents in solr, not just TTL 
based deletes)

: > 1) nothing would ensure that docs *ever* get removed during perioids when
: > docs aren't being added (thus no new segments, thus no merging)
: >
: This can be done with a periodic/smart thread that wakes up every 'ttl' and
: checks min-max (or histogram) of timestamps on segments. If there are a
: lot, do merge (or just delete the whole dead segment). At least that's how
: those systems do it.

OK -- with lucene/solr today we have the ConcurrentMergeScheduler which 
will watch for segments that have many (logically deleted) documents 
flaged "not alive" and will proactively merge those segments when the 
number of docs is above some configured/default threshold -- but to 
automatically flag those documents as "deleted" you need something like 
what solr is doing today.


Again: i really feel like the only disconnect here is terminology.

You're describing a background thread that wakes up periodically, scans 
the docs in each segment to see if they have an expire field > $now, and 
based on the size of the set of matches merges some segments and expunges 
the docs that were in that set.  For segments that aren't merged, docs 
stay put and are excluded from queries only by filters specified at 
request time.

What Solr/Lucene has are 2 background threads: one wakes up periodically, 
scans the docs in the index to see if the expire field > $now and if so 
flags them as being "not alive" so they don't match queries at request 
time. A second thread chegks each segment to see how many docs are marked 
"not alive" -- either by the previous thread or by some other form of 
(logical) deletion -- and merges some of those segments, expunging the 
docs that were marked "not alive".  For segments that aren't merged, the 
"not alive" docs are still in the segment, but the "not alive" flag 
automatically excludes them from queries.



-Hoss
http://www.lucidworks.com/

Reply via email to