Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMBARI-26312: Clean up RequestScheduleEntity and RequestScheduleBatchRequestEntity also #3946

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

eubnara
Copy link
Contributor

@eubnara eubnara commented Feb 26, 2025

What changes were proposed in this pull request?

If some classes implements "Cleanable", CleanupDriver will call cleanup() for those classes when administrator uses "ambari-server db-purge-history".
"requestschedule" and "requestschedulebatchrequest" tables could be cleaned up with old rows.

How was this patch tested?

manual tests on my company's cluster.

idsSubList.get(0) + " - " + idsSubList.get(idsSubList.size() - 1));
requestScheduleQuery.setParameter("scheduleIds", idsSubList);
affectedRows += requestScheduleQuery.executeUpdate();
LOG.info("Deleting RequestScheduleBatchRequest entity batch with schedule ids: " +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RequestSchedule is related to RequestScheduleBatchRequest.
I guess that RequestSchedule is usually removed with RequestScheduleBatchRequest.

  @Override
  public void delete() {
    readWriteLock.writeLock().lock();
    try {
      if (isPersisted) {
        batchRequestDAO.removeByScheduleId(requestScheduleEntity.getScheduleId());
        requestScheduleDAO.remove(requestScheduleEntity);
        cluster.refresh();
        isPersisted = false;
      }
    } finally {
      readWriteLock.writeLock().unlock();
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant