示例#1
0
  private void purgeSnapshots(final List<Long> snapshotIds) {
    // note that events are not deleted
    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotDependencies(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotDuplications(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotSource(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotViolations(snapshotId);
    }
    session.commit();

    List<Long> metricIdsWithoutHistoricalData = purgeMapper.selectMetricIdsWithoutHistoricalData();
    if (!metricIdsWithoutHistoricalData.isEmpty()) {
      for (Long snapshotId : snapshotIds) {
        purgeMapper.deleteSnapshotWastedMeasures(snapshotId, metricIdsWithoutHistoricalData);
      }
      session.commit();
    }

    List<Long> characteristicIds = purgeMapper.selectCharacteristicIdsToPurge();
    if (!characteristicIds.isEmpty()) {
      for (Long snapshotId : snapshotIds) {
        purgeMapper.deleteSnapshotMeasuresOnCharacteristics(snapshotId, characteristicIds);
      }
      session.commit();
    }

    for (Long snapshotId : snapshotIds) {
      purgeMapper.updatePurgeStatusToOne(snapshotId);
    }
    session.commit();
  }
示例#2
0
  private void deleteSnapshots(final List<Long> snapshotIds) {
    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotDependencies(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotDuplications(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotEvents(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotMeasureData(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotMeasures(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotSource(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshotViolations(snapshotId);
    }
    session.commit();

    for (Long snapshotId : snapshotIds) {
      purgeMapper.deleteSnapshot(snapshotId);
    }

    session.commit();
  }