Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-13174

Runs are returned in a strange order

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: API, App Fabric
    • Labels:
      None
    • Rank:
      1|i00b87:

      Description

      The runs endpoint returns run records in a weird order. It's ordered first by state, with running > starting > (completed | failed | killed).

      Within running and starting, the records are ordered by runid.

      Within completed, failed, or killed, the records are ordered by start time.

      I don't think this is intentional, as the row keys in the internal Table follow the following format:

       * runRecordStarting|namespace|app|version|programtype|program|runid
       * runRecordStarted|namespace|app|version|programtype|program|runid
       * runRecordSuspended|namespace|app|version|programtype|program|runid
       * runRecordCompleted|namespace|app|version|programtype|program|inverted start time|runid
      

      This is inconsistent and confusing. It seems like the only reason to have a schema like this is if we wanted to efficiently scan for all run records in one of these quasi-states.

      To me, it would make the most sense if everything was just ordered by start time, with everything having the same row prefix and everything including the inverted start time. This would also make each record correspond to a single row, instead of the four different possible rowkeys we have now, which requires four different lookups each time a run record is looked up.

      This also makes it impossible to get the most recent run without examining all runs and sorting.

        Attachments

          Activity

            People

            • Assignee:
              bhooshan Bhooshan Mogal
              Reporter:
              ashau Albert Shau
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: