2

Can someone explain me what are semgents in solr.

I have not found good description online.

I have also seen various segments file in solr? what are there for. What happens if I delete one segment file.? will that corrupt the index? I am using solr 5.3(if that makes any difference)

Also whar are tlogs and what are there role?

Ankit Bansal
  • 2,162
  • 8
  • 42
  • 79
  • Possible duplicate of [What are segments in Lucene?](http://stackoverflow.com/questions/2703432/what-are-segments-in-lucene) – MatsLindh Feb 27 '17 at 10:53

1 Answers1

6

The segment files in Solr are parts of the underlying Lucene index. You can read about the index format in the Lucene index docs.

In principle, each segment contains a part of the index. New files get created when you add documents and you can completely ignore them. Only if you have problems with too many open file handles you my merge some of them together with the index OPTIMIZE command.

And yes, deleting one of the files will corrupt the index.

The tlog files are transaction logs where every index changing transaction (ADD, UPDATE, DELETE) is written down. If anything happens to your Solr server while there's an open segment currently undergoing a some transactions, the segment file will be corrupt. Solr then uses the tlog to rewind the already transmitted transactions and restore the failed segment to its best guess. You can read more on this in this nice post on the Lucidworks blog.

sven.windisch
  • 432
  • 2
  • 10