Example #1
0
def isTagged(se,msgId,clusLocName):
    q = Query('storageid:' + str(FastEmailParser.convertLongToOverflownFASTInt(long(msgId))) +  ' and meta.contentid:' + clusLocName)
    #print q
    q.getSearchParameters().setParameter(SearchParameter(BaseParameter.SORT_BY, "+" + AbstractEmailParser.STORAGE_ID))
    q.getSearchParameters().setParameter(SearchParameter('hits',100))
    retry = True
    retries = 10

    while retry == True:
        try:
            qr = se.search(q)
            if qr is None:
                print '# FAST null seach result for ' + q
                sys.exit(1)
            #print '# result count', qr.getDocCount()
            if qr.getDocCount() == 0:
                return False
            i = qr.documents()
            while i.hasNext():
                doc = i.next()
                custId  = int(doc.getSummaryField("customerid").getSummary())
                #print msgId,clusLocName,custId
                if custId != -1:
                    return False
            retry = False
        except:
            print 'Exception caught:',sys.exc_info(),traceback.print_exc(file=sys.stderr)
            retries = retries - 1
            retry = (retries > 0)

    return (retries > 0)
Example #2
0
    se = createSearchEngine(mc)
    cm = mc.getClusterManager()
    cl = cm.getClusterLocation(int(clusLocId))

    cfFile = 'cf' + '-' + clusLocId + '-' + str(hash(row1)) + '.sh'
    cfMsgs = []

    for line in f:
        parts = line.split(' ')
        if len(parts) != 2:
            continue
        partId = parts[0].strip()
        storeId = parts[1].strip()
        if not partId.isdigit():
            continue
        msgId = str(FastEmailParser.convertOverflownFASTIntToLong(int(storeId)))
        (m,c,i,s) = getDBData(partId,msgId)
        # treat as deleted if not found or 
        # if clus loc does not match and not legacy location
        notFound = (c == 0 and i ==0)
        isDup = (i >= 100 and i != int(clusLocId))
        if notFound or isDup:
            print time.asctime(),'Message %s needs deletion (nf=%d,dup=%d,dbloc=%d)' % (msgId,notFound,isDup,i)
            cfMsgs.append(storeId)
            # if exists, refeed to location where DB says it is
            # to be sure we have it there.
            if not notFound:
                print time.asctime(),'Refeed',msgId,'@',i,'to',clusLocId,'cust',c
                senderId,recipIds = getUserDBData(partId,msgId)
                refeedMessage(mc,i,partId,msgId,c,senderId,recipIds)
        else: