func (f *flusher) processDelete(mut *Mutation, docid []byte) { idxInst, _ := f.indexInstMap[mut.uuid] partnId := idxInst.Pc.GetPartitionIdByPartitionKey(mut.partnkey) var partnInstMap PartitionInstMap var ok bool if partnInstMap, ok = f.indexPartnMap[mut.uuid]; !ok { logging.Errorf("Flusher:processDelete Missing Partition Instance Map"+ "for IndexInstId: %v. Skipped Mutation Key: %v", mut.uuid, mut.key) return } if partnInst := partnInstMap[partnId]; ok { slice := partnInst.Sc.GetSliceByIndexKey(common.IndexKey(mut.key)) if err := slice.Delete(docid); err != nil { logging.Errorf("Flusher::processDelete Error Deleting DocId: %v "+ "from Slice: %v", docid, slice.Id()) } } else { logging.Errorf("Flusher::processDelete Partition Instance not found "+ "for Id: %v. Skipped Mutation Key: %v", partnId, mut.key) } }
func (f *flusher) processUpsert(mut *Mutation, docid []byte) { idxInst, _ := f.indexInstMap[mut.uuid] partnId := idxInst.Pc.GetPartitionIdByPartitionKey(mut.partnkey) var partnInstMap PartitionInstMap var ok bool if partnInstMap, ok = f.indexPartnMap[mut.uuid]; !ok { logging.Errorf("Flusher::processUpsert Missing Partition Instance Map"+ "for IndexInstId: %v. Skipped Mutation Key: %v", mut.uuid, mut.key) return } if partnInst := partnInstMap[partnId]; ok { slice := partnInst.Sc.GetSliceByIndexKey(common.IndexKey(mut.key)) key, err := GetIndexEntryBytesFromKey(mut.key, docid, idxInst.Defn.IsPrimary) if err != nil { logging.Errorf("Flusher::processUpsert Error indexing Key: %s "+ "docid: %s in Slice: %v. Error: %v. Skipped.", mut.key, docid, slice.Id(), err) if err2 := slice.Delete(docid); err2 != nil { logging.Errorf("Flusher::processUpsert Error removing entry due to error %v Key: %s "+ "docid: %s in Slice: %v. Error: %v", err, mut.key, docid, slice.Id(), err2) } return } if err := slice.Insert(key, docid); err != nil { logging.Errorf("Flusher::processUpsert Error Inserting Key: %s "+ "docid: %s in Slice: %v. Error: %v", mut.key, docid, slice.Id(), err) } } else { logging.Errorf("Flusher::processUpsert Partition Instance not found "+ "for Id: %v Skipped Mutation Key: %v", partnId, mut.key) } }