-
Notifications
You must be signed in to change notification settings - Fork 42
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
Edit a dataset #498
Comments
To that list of properties we should add: Data set name type -- string -- PDS, PDS-E or SEQ |
A note about locking. Datasets can be opened for sharing (DISP=SHR) and if you want exclusive access, you use (DISP=OLD). Locking at the member level is also possible, and ISPF EDIT does this when you open a member. So a simple model would be to have an EDIT option when you open a dataset or member. The default would be BROWSE @NakulManchanda @1000TurquoisePogs That's the way dataset access works on z/OS. Do you think this is acceptable, rather than deciding after a long edit session on a shared file, |
There's a lot of unfinished work here that you may be able to continue and improve upon to save time: |
Hi, I recommend we use, https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxb600/rda.htm, to handle data set creation. There's a lot of work done already, so I suppose we could use DYNALLOC. I'm just not sure why you'd want to when BPXWDYN is available. |
I'm trawling through the 12 or so repos (I note Sean's comment that I should just focus in the repos "zss" and "zowe-common-c" for all the mainframe tasks), and I note Jordan's comment about using BPXWDYN (looks like it calls DYNALLOC) rather that DYNALLOC directly. BTW I notice that invocations of many SVC's, including SVC 99 (DYNALLOC) are already present in zowe-common-c. I don't plan to use them for this task. The parms you can specify for BPXWDYN look fine to me, and I think we want to access datasets via USS, rather than use a TSO session where we can issue ALLOCATE, or some environment where we can issue SVC 99. I've also seen |
Work plan
Work progress |
Zowe REST API to access z/OS datasets. I will enhance this API (see
For GET, the lock will be an exclusive ENQ on the dataset or member. It will be specified in a custom HTTP header, not as a query parameter. The header will be optional, so the default will be "no lock", as at present. For PUT, the lock will be released by DEQ. The default will be DEQ=TRUE, but you can specify DEQ=FALSE in the HTTP header if you want to retain the lock. (correction; I think this should be POST, because the side-effect of DEQ makes it not idempotent. So PUT if the user wants "SAVE and continue", and POST if they want "SAVE and EXIT". |
I believe there is currently a DELETE, for removing a dataset. Do you think a lock is needed there as well? |
No, it's an atomic action for a dataset, including a PDS. However, if you want to delete a MEMBER, then you probably want to silently ENQ the PDS because you will effectively be updating the directory. Curiously, z/OSMF does not externalise an offer to ENQ when deleting a member of a PDS, but maybe it's a given that exclusive ENQ on the PDS is required for that, just for the (short) duration of the DELETE. If the dataset or member is in use, DELETE will fail. Taking an exclusive ENQ first will fail too, so all you gain is a clearer reason why the request failed. |
@John-A-Davies @1000TurquoisePogs @ifakhrutdinov @OnnoVdT Design Decisions
Need answers to questions
|
Hi Nakul,
Thanks for capturing those - I've incorporated them in my document.
|
@John-A-Davies @1000TurquoisePogs @ifakhrutdinov @OnnoVdT Alternate proposal to go towards Optimistic Locking route Comparison between optimistic & pessimistic locking: Optimistic locking approach using e-tags: Flow of request:
Trick is: how to determine file on server is newer
Advantage over pessimistic:
Need answers to questions
|
Joe Winchester 4:59 PM |
DAVID MCKNIGHT 6:01 PM |
Pessimistic lock is required for rollout to z/OS customers. If the file is a PPT or PARMLIB my experience from working with other file editing tools is that they insist on pessimistic locking being in the file editor. I'd like to see File Editor implement pessimistic locking as the MVP for moving forward from beta mode which is story number 1). It'd be good also to have some kind of visual to show the file is locked, perhaps a padlock. Optimistic locking is a separate story, and perhaps there could be a way to show with an unlocked padlock that the file isn't locked and allow a way to place the lock on if the user decides they want to lock it. Ideally when both are done it could be the system programmer who configures Zowe who makes the central choice which is the default, and also perhaps for which data set matching patterns so that some data set patterns are pessimistic and some are optimistic. |
Hi @1000TurquoisePogs @John-A-Davies @ifakhrutdinov
I think we need separate lock server process, to manage locks and transaction.
Separate process hopefully will simplify zss http server code as well, which can convert lock server responses to appropriate http status codes and respond to user. Hope, this makes sense. Need a discussion that above suggestion can fly. Thanks! |
Nakul, |
Bear in mind that some of the actions in this area require APF authorisiation. We want to avoid the requirement for the zssServer to be APF authorised. For example, if you want to acquire a SYSDSN lock like ISPF EDIT does on the dataset, you need to be authorised, at least for EXC access. I have not tried SYSDSN with SHR. For z/OS Explorer, RSE threadpool and daemon are APF-authorized... you can find more about that here: |
@struga0258 FYI as discussed today. |
On the topic of dataset creation: datasetMetadata code that we have already can determine properties of existing datasets, therefore the creation API can support the "allocate like" feature by using a dataset name as input, and doing the lookup of properties internal to zss. |
After discussion with @1000TurquoisePogs just now, I'm going to try the following experiment: Create a separate URI for dataset ENQ. This will be handled with
Which will run in the zss server's core, so the ENQ will persist. The zss core will thus have to manage a list of ENQs. Code to operate this as a hash table already exists in |
@John-A-Davies you cannot impersonate without running in a subtask. It'd be bad to change the impersonation of the main thread. |
@OnnoVdT I don't think POST/WAIT would be needed, since you can just use POSIX synchronization mechanisms. |
@OnnoVdT I'm using |
|
This clearly shows my home-turf is different than yours, :) I didn't even consider POSIX C would have similar constructs. |
@OnnoVdT Would be nice if it supported POSIX, but I think the z/OS implementation is called SYSTEM V. It has different primitives from POSIX. |
We discussed the API and which HTTP methods to use for each URI. My suggestions were:
We thought that there are no absolute answers. We were OK with line 4 instead of line 5. Comments welcome! |
From an outside in design two interactions for opening a file
The API for this is best as one call, to avoid race conditions
When user A is finished editing the file they should do a PUT with the contents, and with DEQUEUE=YES. This would release the lock. If user A decides to discard and not update the contents then a POST. Following these through the APIs needed are 2, 3 and 5 only - with the difference between that the header data to put the lock flows on 3. |
In my opinion, term enqueue may not be something newcomers or even normal z/OS users know, this is usually used by systems programmers. We should use terminology familiar to normal users. Maybe DISP or mode={read|write}? |
@John-A-Davies , how do other similar servers implement this on other platforms (e.g. for accessing files)? Perhaps there is a standard approach we shouldn't reinvent. |
API proposal for the code to be delivered in 2020 Q4:
|
@struga0258 FYI the API calls above are the ones the Editor uses for this feature. They should be tested. The new API is not to be published as yet. |
The set of current PRs for this issue are here: Pull requests Zlux: |
Implementation questions:
|
for Q1, Can a different user DEQ a dataset that's currently ENQ by the first user? |
For Q2, semaphores held by zss when the zss server terminates. My understanding is ZSS does the actual enqueue, and thus according to the system, ZSS is the owner. When the ZSS address space terminates, the system will release all locks held by that address space as part of normal RTM cleanup. Your tracking file will still know about the locks so you can re-establish them once ZSS comes up, or have a hot stand-by take over, but there will be a window where the files are not locked while the owner thinks they are. |
@OnnoVdT Just to be clear, the real ISGENQ dataset enqueue and the semaphore are both held in the process that's created to impersonate the user, so the ENQ is held in the name of the user who issued the GET datasetEnqueue. The ENQ is gracefully released when the user posts the semaphore, or ungracefully when the process dies. The dataset-to-semaphore relationship is held in memory of the zss process. |
Baseline statement of known issues with code in the
|
These were some of the design goals:
1,4 - done 2(avoid deadlock) is absolutely necessary, will be accomplished with these two items, as commented above by John.
FYI @John-A-Davies @Joe-Winchester @1000TurquoisePogs @ifakhrutdinov |
Discussion of item 2; avoiding deadlock. The purpose of this item is to release locks the WEBUI user has taken on datasets in the cases when the user has not specifically released them. Created #570 for this. |
We ended up implementing this for now zowe/zss#355 and it seems to be working simply. So, lets close this epic as completed. If specifically pessmistic writing is needed in the future, we'll take a look at this work again. |
ZSS needs capability to create sequential and partitioned datasets.
ZSS DatasetService
Examples from zosmf:
https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.izua700/IZUHPINFO_API_CreateDataSet.htm#CreateDataSet
Create Sequential Dataset
Create Partitioned Dataset:
Properties for request payload:
Table 1. Request body to create a sequential and partitioned data set
Result:
The text was updated successfully, but these errors were encountered: