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

Update disk completion status when files are discarded #52

Open
smclay opened this issue Jul 5, 2021 · 5 comments
Open

Update disk completion status when files are discarded #52

smclay opened this issue Jul 5, 2021 · 5 comments

Comments

@smclay
Copy link
Contributor

smclay commented Jul 5, 2021

We have some test NGAS servers. They have a limited disk capacity. We use them intensively for testing other software applications. In order to prevent the disks from being completely filled up I have a utility script that runs once per weeks and discards all files more than one day old. However, the tests have been more intensive than normal and the disks were filled to capacity. This highlighted an issue.

When the disks reach capacity they are marked as completed. My utility script then discarded old files freeing up lots of disk space. However, NGAS does not automatically update the completed status. I have to manually edit the database table. I think it would be very useful if NGAS was smart enough to check and update the completion status when files are discarded. Perhaps the janitor or data check thread could monitor the completion status.

@awicenec
Copy link
Contributor

awicenec commented Jul 5, 2021 via email

@rtobar
Copy link
Contributor

rtobar commented Jul 6, 2021

The janitor thread actually already checks the disk space:

def run(srvObj, stopEvt):
"""
Check if there is enough disk space for the various
directories defined.
"""
try:
srvObj.checkDiskSpaceSat()
except Exception:
logger.exception("Not enough disk space, bringing the system Offline")
# Connect to the server and send an OFFLINE command
host, port = srvObj.get_self_endpoint()
auth = None
if srvObj.getCfg().getAuthorize():
auth = srvObj.getCfg().getAuthHttpHdrVal(NGAMS_HTTP_INT_AUTH_USER)
client = ngamsPClient.ngamsPClient(host, port, timeout=30, auth=auth)
client.offline(force=True)

But the only thing it does is bring the server to Offline state if the disk is full, there's no flag clearing. Apart from the options that Andreas mentioned, I'd say adding some extra logic wouldn't hurt. If we wanted to be conservative we could have a new option to enable the behavior.

@smclay
Copy link
Contributor Author

smclay commented Jul 6, 2021

@awicenec I am using the NGAS DISCARD command for removing old files and retrieving disk space. Therefore making changes in the DISCARD command would work for us.
@rtobar adding an extra config property to enable new functionality in the janitor to update the completion status of disks would also work for us.
Basically either solution would be great. Anything that avoids manually poking in the database would help us a lot.

@awicenec
Copy link
Contributor

awicenec commented Jul 6, 2021 via email

@awicenec
Copy link
Contributor

awicenec commented Jul 6, 2021 via email

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

No branches or pull requests

3 participants