IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28147


Ignore:
Timestamp:
May 27, 2010, 1:41:26 PM (16 years ago)
Author:
bills
Message:

postage stamp server changes from the trunk to work around problem reported in ticket 1388

Location:
tags/ipp-20100525
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20100525/PS-IPP-PStamp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • tags/ipp-20100525/ippTools

  • tags/ipp-20100525/ippTools/share/pstamptool_getdependent.sql

    r27856 r28147  
    11SELECT DISTINCT pstampDependent.*
    22FROM pstampDependent
    3 -- JOIN pstampJob USING(dep_id)
    4 -- JOIN pstampRequest USING(req_id)
    53WHERE pstampDependent.state = 'new'
  • tags/ipp-20100525/ippTools/share/pstamptool_revertdependent.sql

    r27795 r28147  
    44SET pstampDependent.fault = 0
    55WHERE pstampDependent.state = 'new'
     6    AND (pstampDependent.fault > 0)
  • tags/ipp-20100525/ippTools/src/pstamptool.c

    r28110 r28147  
    3030#include "pxdata.h"
    3131#include "pstamptool.h"
     32#include "pstamp.h"
    3233
    3334static bool adddatastoreMode(pxConfig *config);
     
    941942    PXOPT_LOOKUP_S16(fault, config->args, "-fault",  false, false);
    942943
    943     // By default only revert faults < 10 which are our "ipp exit codes"
     944    // By default only revert faults < PSTAMP_FIRST_ERROR_CODE which are our "ipp exit codes"
    944945    // codes larger than that are the pstamp request interface.
    945946    // Don't fault those unless -fault waa provided
    946     psString faultClause = "";
     947    psString faultClause = psStringCopy("");
    947948    if (!fault) {
    948         faultClause = " \nAND (pstampJob.fault < 10)";
     949        psStringAppend(&faultClause, " \nAND (pstampJob.fault < %d)", PSTAMP_FIRST_ERROR_CODE);
    949950    }
    950951
     
    963964
    964965    if (!p_psDBRunQueryF(config->dbh, query, faultClause)) {
    965         psError(PS_ERR_UNKNOWN, false, "database error");
    966         return false;
    967     }
     966        psFree(faultClause);
     967        psFree(query);
     968        psError(PS_ERR_UNKNOWN, false, "database error");
     969        return false;
     970    }
     971
     972    psFree(faultClause);
    968973
    969974    return true;
     
    11351140            psFree(output);
    11361141            return false;
     1142        }
     1143        psS32 fault = psMetadataLookupS64(NULL, dep, "fault");
     1144        if (fault > 0) {
     1145            fprintf(stderr, "existing dependent has fault %d\n", fault);
     1146            exit (fault);
    11371147        }
    11381148        printf("%" PRId64 "\n", dep_id);
     
    13171327        return false;
    13181328    }
     1329
     1330    PXOPT_LOOKUP_S16(fault,      config->args, "-fault",          false, false);
     1331
    13191332    psString query = pxDataGet("pstamptool_revertdependent.sql");
    13201333    if (!query) {
     
    13281341    psFree(where);
    13291342
     1343    if (!fault) {
     1344        // unless asked to clear a specific fault value, restrict reverts to fault codes
     1345        // that are less than the minimum fault in the API
     1346        psStringAppend(&query, " AND (pstampDependent.fault < %d)", PSTAMP_FIRST_ERROR_CODE);
     1347    }
     1348
    13301349    if (!p_psDBRunQuery(config->dbh, query)) {
    13311350        psError(PS_ERR_UNKNOWN, false, "database error");
  • tags/ipp-20100525/pstamp

  • tags/ipp-20100525/pstamp/scripts/pstamp_checkdependent.pl

    r28135 r28147  
    307307            # ... and fault the dependent so that we have a record of the error
    308308            my_die("failed to find warpSkyCelllMap for warpRun $warp_id skycell_id $skycell_id",
    309                 $PS_EXIT_DATA_ERROR);
     309                $PSTAMP_GONE);
    310310        }
    311311
  • tags/ipp-20100525/pstamp/scripts/pstampparse.pl

    r28081 r28147  
    829829            run(command => $command, verbose => $verbose);
    830830        unless ($success) {
    831             my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
    832         }
    833         my $output = join "", @$stdout_buf;
    834         chomp $output;
    835         $dep_id = $output;
    836         #
    837         # XXX: need to fault the request or something
    838         my_die("pstamptool -getdependent returned invalid dep_id", $PS_EXIT_PROG_ERROR) if !$dep_id;
     831            my $fault = $error_code >> 8;
     832            print STDERR "$command failed with fault $fault\n";
     833            if ($fault >= 10) {
     834                $$r_dep_id = 0;
     835                $$r_fault = $fault;
     836                $$r_jobState = 'stop';
     837                return;
     838            }
     839            # for now just die. Later pstamptool will return the whole dependent so we can
     840            # examine the fault code
     841            my_die("$command failed with unexpected fault value: $fault", $PS_EXIT_UNKNOWN_ERROR);
     842        } else {
     843            my $output = join "", @$stdout_buf;
     844            chomp $output;
     845            $dep_id = $output;
     846            #
     847            # XXX: need to fault the request or something
     848            my_die("pstamptool -getdependent returned invalid dep_id", $PS_EXIT_PROG_ERROR) if !$dep_id;
     849        }
    839850    } else {
    840851        print STDERR "skipping $command\n";
  • tags/ipp-20100525/pstamp/src/pstamp.h

    r26242 r28147  
    99typedef enum {
    1010        PSTAMP_SUCCESS          = 0,
     11        PSTAMP_FIRST_ERROR_CODE = 10,
    1112        PSTAMP_SYSTEM_ERROR     = 10,
    1213        PSTAMP_NOT_IMPLEMENTED  = 11,
Note: See TracChangeset for help on using the changeset viewer.