Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
added comments
  • Loading branch information
pdmars authored and labisso committed Oct 23, 2010
1 parent f2c9738 commit 64363ab
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
22 changes: 22 additions & 0 deletions service/service/java/source/src/org/globus/workspace/Backfill.java
Expand Up @@ -187,6 +187,15 @@ public void cancelBackfillRequest() {
this.backfillReqFile.delete();
}

/**
* This method should be called on service startup. It is responsible for
* starting the backfill timer (if the backfill feature is enabled).
*
* It also checks to see if a persistence backfill file exists, and if the
* backfill configuration has changed. If the backfill configuration has
* changed then it cancels the previous backfill request and submits a new
* one.
*/
public void initiateBackfill() throws Exception {

if (this.backfillDisabled == false) {
Expand Down Expand Up @@ -232,6 +241,8 @@ public void launchBackfillTimer() {
this.retryPeriod * 1000);
}

// Returns true if a backfill node was successfully killed.
// False, if it wasn't able to kill a backfill node.
public boolean terminateBackfillNode() {

int vmid;
Expand All @@ -258,6 +269,17 @@ public boolean terminateBackfillNode() {
return false;
}

/**
* This attempts to launch a new backfill node.
* It should only be called by the backfill timer (ugh,
* should really be changed so ONLY that can happen).
* If backfill nodes should be launched (at some place else
* in the code) then the backfill timer should simply be relaunched
* (via the launchBackfillTimer method in this class)
* as it will attempt to launch backfill nodes. The timer is what
* respects the max backfill instances configuration value, and if
* backfill is disabled then it won't be relaunched.
*/
public void createBackfillNode() throws Exception {

CreateRequest req = this.getBackfillRequest("BACKFILL_REQUEST");
Expand Down
Expand Up @@ -291,6 +291,9 @@ private Reservation scheduleImpl(NodeRequest req)
final String invalidResponse = "Implementation problem: slot " +
"manager returned invalid response";

// If a request is denied (and it's not a backfill request) then we
// should attempt to kill backfill nodes until there are no more
// backfill nodes to kill or until the request can be satisfied.
Reservation res = null;
try {
res = this.slotManager.reserveSpace(req);
Expand Down Expand Up @@ -895,6 +898,9 @@ private void remove(int vmid) throws ManageException {
this.slotManager.releaseSpace(vmid);
this.db.deleteNodeRequest(vmid);

// Check to see if this was a backfill request being killed off.
// If not, relaunch the backfill timer to deploy backfill nodes
// on *potentially* empty slots.
if ((this.slotManager.isOldBackfillID(vmid) == false) &&
(this.slotManager.isCurrentBackfillID(vmid) == false)) {
logger.debug("Relaunching backfill timer");
Expand Down
Expand Up @@ -707,6 +707,18 @@ public boolean isCurrentBackfillID(int vmid) {
return this.backfillVMs.contains(vmid);
}

/**
* The following two methods, populateBackfillHashTable and
* writeBackfillHashTable simply read and write a small file
* that contains the current status of the backfill hash table
* (for persistence).
*
* Thus, whenever the backfill hash table is updated,
* writeBackfillHashTable should be called (gross) to make sure
* the version on disk matches the current hash table. And
* whenever the service has started, populateBackfillHashTable
* should be called to read in the version on the disk.
*/
private void populateBackfillHashTable() {
try {
logger.debug("Attempting to read backfill hash table file:\n" +
Expand Down

0 comments on commit 64363ab

Please sign in to comment.