AnsweredAssumed Answered

What happens under the hood with PIPoint.UpdateValue and the Remove option?

Question asked by I.Berry on May 29, 2015
Latest reply on May 29, 2015 by Rhys Kirk

Hi,

 

We have a script which exists to delete data from the archive that is not required. There are some queries to find points that we would like to remove, then there is a call to remove each of the values that looks like this:

#now delete

foreach ( $pointResults in $listResults)

{

        $valuesToDelete = $pointResults | Where-Object {$_.Value.Name -eq "Set To Bad" }

        if($valuesToDelete.Count -gt 0)

        {

           

            write-output "** Deleting Values for  **"

            write-output $valuesToDelete | select PiPoint, Value, Timestamp | Format-Table

            foreach($deleteValue in $valuesToDelete)

            {

                $pointResults.PIPoint.UpdateValue($deleteValue,[OSIsoft.AF.Data.AFUpdateOption]::Remove)

            }

        }

}

 

 

Also going on at the same time on the PI server are a lot of queries and interfaces writing to the same tags that values are being deleted from. The PI server version is 3.4.380.

 

This works OK, but when this script is running on a loaded server we notice a few problems

1) Other data consumers start getting RPC Timeouts

2) Some messages in the log like this T:3532 PT(ptid=2201,recno=2201,loc=11,flag=8): ptwait tick/timeout=120011/120000, RID|LLL|LC|LI|NAL=0|5|1|0|254 Lock[253].uc=4 QL.sc/tid=0/3704 threads=2,0,0 [-11106] Failed to lock archive-cache point

 

These updates go into the exception queue, but it seems that when they are being processed it is either very expensive, or there is a lock that is preventing other things from happening normally, causing RPC timeouts (or both).

 

We can throttle the points updates with re@move, but I was wondering if the point really does get locked for all updates while this operation is going on? Also, are there any alternative methods we should be looking at using to achieve this same functionality?

 

Many thanks for any ideas or explanations.

 

Regards,

Ivan

 

 

Outcomes