Project

General

Profile

« Previous | Next » 

Revision 59405

Trying to avoid mdstore to store transaction of cancelled feeding

View differences:

MDStoreFeeder.java
60 60
                writeOps = mdstore.feed(records, refresh, mdformats);
61 61
            }
62 62

  
63
			dao.commit(mdstore.getId(), mdId);
64

  
65
			int size = dao.refreshSize(mdId);
66

  
67
			touch(mdId, size);
68

  
69
			log.info("Finished feeding mdstore " + mdId + " - new size: " + size);
70

  
71
			doneCallback.call(buildParams(size, writeOps));
63
            if(writeOps == -1){
64
            	//means the process was cancelled, so we must not commit
65
				log.warn(String.format("The feeding process on mdstore %s has been cancelled. Records will not be committed. Transaction %s set as invalid.", mdId, transactionId));
66
				dao.invalidTransaction(transactionId, mdId);
67
				failCallback.call(new MDStoreServiceException(String.format("Feeding cancelled for mdstore %s on transaction %s", mdId, transactionId)));
68
            }
69
            else {
70
				dao.commit(mdstore.getId(), mdId);
71
				int size = dao.refreshSize(mdId);
72
				touch(mdId, size);
73
				log.info("Finished feeding mdstore " + mdId + " - new size: " + size);
74
				doneCallback.call(buildParams(size, writeOps));
75
			}
72 76
		} catch (Throwable e) {
73 77
			if (transactionId != null) {
74 78
				dao.invalidTransaction(transactionId, mdId);

Also available in: Unified diff