You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Atita Arora <at...@gmail.com> on 2018/05/06 21:09:25 UTC

Determine Solr Core Creation Timestamp

Hi,

I am working on a developing a utility which lets one monitor the
indexPipeline Status.
The indexing job runs in two forms where either it -
1. Creates a new core OR
2. Runs the delta on existing core.
To put down to simplest form I look into the DB timestamp when the indexing
job was triggered and have a desire to read some stat / metric from Solr
(preferably an API) which reports a timestamp when the CORE was created /
modified.
My utility completely relies on the difference between timestamps from DB &
Solr as these two timestamps are leveraged to determine health of pipeline.

I see the Master Version Timestamp under each shard which details the
version / Gen / Size.
Is that what I should be using ? How can I grab these from API ?
I tried using metrics api :
*http://localhost:8983/solr/admin/metrics?group=core&prefix=CORE
<http://localhost:8983/solr/admin/metrics?group=core&prefix=CORE>*
which details *CORE.startTime *but this timestamp changes whenever data is
being added to any core on this node.
*Is there any other suggestion to use some other way to determine the core
creation timestamp* ?

Please help !

Thanks,
Atita

Re: Determine Solr Core Creation Timestamp

Posted by Atita Arora <at...@gmail.com>.
Thank you Shawn for looking into this to such a depth.
Let me try getting hold of someway to grab this information and use it and
I may reach back to you or list for further thoughts.

Thanks again,
Atita

On Tue, May 8, 2018, 3:11 PM Shawn Heisey <ap...@elyograg.org> wrote:

> On 5/7/2018 3:50 PM, Atita Arora wrote:
> > I noticed the same and hence overruled the idea to use it.
> > Further , while exploring the V2 api (as we're currently in Solr 6.6 and
> > will soon be on Solr 7.X) ,I came across the shards API which has
> > "property.index.version": "1525453818563"
> >
> > Which is listed for each of the shards. I wonder if I should be
> leveraging
> > this as this seem to be the index version & I dont think this number
> should
> > vary on restart.
>
> The index version is a number that is milliseconds since the epoch --
> 1970-01-01 00:00:00 UTC.  This is how Java represents timestamps
> internally.  All Lucene indexes have this information.
>
> The index version value appears to update every time the index changes,
> probably when a new searcher is opened.
>
> For SolrCloud collections, this information is actually already
> available, although getting to it may not be obvious.  ZooKeeeper itself
> keeps track of when all znodes are created, so the /collections/xxxxx
> znode creation time is effectively what you're after.  This can be seen
> in Cloud->Tree in the admin UI, which means that there is a way to
> obtain the information with an HTTP API.
>
> When cores are created or manipulated by API calls, the core.properties
> file will have a comment with a timestamp of the last time Solr
> wrote/changed the file.  CoreAdmin operations like CREATE, SWAP, RENAME,
> and others will update or create the timestamp in that comment, but if
> the properties file doesn't ever get changed by Solr, then the comment
> would reflect the creation time.  That makes it not entirely reliable.
> Also, I do not know of a way to access that information with any Solr
> API -- access to the filesystem would probably be required.
>
> The core.properties file could be a place to store a true creation time,
> using a new property that Solr doesn't need for any other purpose.  Solr
> could look for a creation time in that file when the core is started and
> update it to include the current time as the creation time if it is not
> present, and certain CoreAdmin operations could also write that
> property.  Retrieving the value would needed to be added to the
> CoreAdmin API.
>
> Thanks,
> Shawn
>
>

Re: Determine Solr Core Creation Timestamp

Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/7/2018 3:50 PM, Atita Arora wrote:
> I noticed the same and hence overruled the idea to use it.
> Further , while exploring the V2 api (as we're currently in Solr 6.6 and
> will soon be on Solr 7.X) ,I came across the shards API which has
> "property.index.version": "1525453818563"
>
> Which is listed for each of the shards. I wonder if I should be leveraging
> this as this seem to be the index version & I dont think this number should
> vary on restart.

The index version is a number that is milliseconds since the epoch --
1970-01-01 00:00:00 UTC.  This is how Java represents timestamps
internally.  All Lucene indexes have this information.

The index version value appears to update every time the index changes,
probably when a new searcher is opened.

For SolrCloud collections, this information is actually already
available, although getting to it may not be obvious.  ZooKeeeper itself
keeps track of when all znodes are created, so the /collections/xxxxx
znode creation time is effectively what you're after.  This can be seen
in Cloud->Tree in the admin UI, which means that there is a way to
obtain the information with an HTTP API.

When cores are created or manipulated by API calls, the core.properties
file will have a comment with a timestamp of the last time Solr
wrote/changed the file.  CoreAdmin operations like CREATE, SWAP, RENAME,
and others will update or create the timestamp in that comment, but if
the properties file doesn't ever get changed by Solr, then the comment
would reflect the creation time.  That makes it not entirely reliable. 
Also, I do not know of a way to access that information with any Solr
API -- access to the filesystem would probably be required.

The core.properties file could be a place to store a true creation time,
using a new property that Solr doesn't need for any other purpose.  Solr
could look for a creation time in that file when the core is started and
update it to include the current time as the creation time if it is not
present, and certain CoreAdmin operations could also write that
property.  Retrieving the value would needed to be added to the
CoreAdmin API.

Thanks,
Shawn


Re: Determine Solr Core Creation Timestamp

Posted by Atita Arora <at...@gmail.com>.
Hi Shawn,

I noticed the same and hence overruled the idea to use it.
Further , while exploring the V2 api (as we're currently in Solr 6.6 and
will soon be on Solr 7.X) ,I came across the shards API which has
"property.index.version": "1525453818563"

Which is listed for each of the shards. I wonder if I should be leveraging
this as this seem to be the index version & I dont think this number should
vary on restart.

Any pointers ?

Thanks,
Atita


On Mon, May 7, 2018 at 11:16 AM, Shawn Heisey <ap...@elyograg.org> wrote:

> On 5/6/2018 3:09 PM, Atita Arora wrote:
>
>> I am working on a developing a utility which lets one monitor the
>> indexPipeline Status.
>> The indexing job runs in two forms where either it -
>> 1. Creates a new core OR
>> 2. Runs the delta on existing core.
>> To put down to simplest form I look into the DB timestamp when the
>> indexing
>> job was triggered and have a desire to read some stat / metric from Solr
>> (preferably an API) which reports a timestamp when the CORE was created /
>> modified.
>> My utility completely relies on the difference between timestamps from DB
>> &
>> Solr as these two timestamps are leveraged to determine health of
>> pipeline.
>>
>> I see the Master Version Timestamp under each shard which details the
>> version / Gen / Size.
>> Is that what I should be using ? How can I grab these from API ?
>> I tried using metrics api :
>> *http://localhost:8983/solr/admin/metrics?group=core&prefix=CORE
>> <http://localhost:8983/solr/admin/metrics?group=core&prefix=CORE>*
>> which details *CORE.startTime *but this timestamp changes whenever data is
>> being added to any core on this node.
>> *Is there any other suggestion to use some other way to determine the core
>> creation timestamp* ?
>>
>
> The startTime value is the time at which Solr started the core.  If that
> is getting updated frequently, then a reload operation is probably
> happening on the core.  Or, less likely, the Solr instance has been
> restarted.  I have checked a 6.6 system and on a core that is getting
> updates as frequently as once a minute, startTime is a couple of days ago,
> which was the last time that core was reloaded.
>
> I've been trying to figure out whether a Lucene index keeps track of the
> time it was created, but I haven't found anything yet.  If it doesn't, I do
> wonder whether there might be some kind of metadata that Solr could write
> to the index to record information like this.  Solr would always have the
> option of writing such metadata to an entirely different location within
> the instanceDir.  The index creation time is probably not the only
> information that would be useful to have available.
>
> Thanks,
> Shawn
>
>

Re: Determine Solr Core Creation Timestamp

Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/6/2018 3:09 PM, Atita Arora wrote:
> I am working on a developing a utility which lets one monitor the
> indexPipeline Status.
> The indexing job runs in two forms where either it -
> 1. Creates a new core OR
> 2. Runs the delta on existing core.
> To put down to simplest form I look into the DB timestamp when the indexing
> job was triggered and have a desire to read some stat / metric from Solr
> (preferably an API) which reports a timestamp when the CORE was created /
> modified.
> My utility completely relies on the difference between timestamps from DB &
> Solr as these two timestamps are leveraged to determine health of pipeline.
>
> I see the Master Version Timestamp under each shard which details the
> version / Gen / Size.
> Is that what I should be using ? How can I grab these from API ?
> I tried using metrics api :
> *http://localhost:8983/solr/admin/metrics?group=core&prefix=CORE
> <http://localhost:8983/solr/admin/metrics?group=core&prefix=CORE>*
> which details *CORE.startTime *but this timestamp changes whenever data is
> being added to any core on this node.
> *Is there any other suggestion to use some other way to determine the core
> creation timestamp* ?

The startTime value is the time at which Solr started the core.  If that 
is getting updated frequently, then a reload operation is probably 
happening on the core.  Or, less likely, the Solr instance has been 
restarted.  I have checked a 6.6 system and on a core that is getting 
updates as frequently as once a minute, startTime is a couple of days 
ago, which was the last time that core was reloaded.

I've been trying to figure out whether a Lucene index keeps track of the 
time it was created, but I haven't found anything yet.  If it doesn't, I 
do wonder whether there might be some kind of metadata that Solr could 
write to the index to record information like this.  Solr would always 
have the option of writing such metadata to an entirely different 
location within the instanceDir.  The index creation time is probably 
not the only information that would be useful to have available.

Thanks,
Shawn