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

dataset locking and heartbeat #223

Closed
wants to merge 61 commits into from
Closed

dataset locking and heartbeat #223

wants to merge 61 commits into from

Conversation

John-A-Davies
Copy link
Contributor

@John-A-Davies John-A-Davies commented Oct 9, 2020

These changes provide support in the zss server for dataset edit with pessimistic locking. It calls ISGENQ in response to a new URI called /datasetEnqueue. The ENQ is held in a waiting process which ends when datasetEnqueue is called with the DELETE verb.

Signed-off-by: John Davies <daviesja@uk.ibm.com>
Signed-off-by: John Davies <daviesja@uk.ibm.com>
Signed-off-by: John Davies <daviesja@uk.ibm.com>
Copy link
Contributor

@ifakhrutdinov ifakhrutdinov left a comment

Choose a reason for hiding this comment

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

@John-A-Davies, please convert this into a draft.

@@ -0,0 +1,19 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used this file a long time ago to try and launch some of the code in a VSCode debugger. I abandoned that, so I don't need the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've deleted it.

@@ -12,7 +12,7 @@ set -e
################################################################################


export _C89_LSYSLIB="CEE.SCEELKED:SYS1.CSSLIB:CSF.SCSFMOD0"
export _C89_LSYSLIB="CEE.SCEELKED:SYS1.CSSLIB:PP.CSF.ZOS203.SCSFMOD0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this compatible with a typical LPAR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's a local change that I needed on my test LPAR. I don't want that change to be pushed to git.

Copy link
Contributor Author

@John-A-Davies John-A-Davies Jan 19, 2021

Choose a reason for hiding this comment

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

I will revert line 15 to its original in Git. The build needs PP.CSF.ZOS203.SCSFMOD0 only on the target z/OS system.

char *l1 = stringListPrint(request->parsedFile, 1, 1, "/", 0);
char *percentDecoded = cleanURLParamValue(response->slh, l1);
char *filenamep1 = stringConcatenate(response->slh, "//'", percentDecoded);
char *filename = stringConcatenate(response->slh, filenamep1, "'");
// char *datasetName = cleanURLParamValue(response->slh, l1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't keep commented out code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a work-in-progress

Copy link
Contributor Author

Choose a reason for hiding this comment

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

commented out code deleted


/* append PID to filename */
pid_t pid = getpid();
char pid_string[10];
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the style the rest of the code uses. That is, use camel case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

code deleted

c/datasetService.c Outdated Show resolved Hide resolved
@ifakhrutdinov
Copy link
Contributor

@John-A-Davies you'll need to point the submodule to the zowe-common-c commit you'd like zss to use. When this is resolved the automation should build the branch. @jackjia-ibm can probably provide more info on that.

File was for visual debugger but is no longer needed
Revert to repo value, keep local file which has changes to dataset names on my test system
changes only needed locally
remove local changes
remove local changes
Signed-off-by: John Davies <daviesja@uk.ibm.com>
Signed-off-by: John Davies <daviesja@uk.ibm.com>
Signed-off-by: John Davies <daviesja@uk.ibm.com>
Copy link
Contributor

@ifakhrutdinov ifakhrutdinov left a comment

Choose a reason for hiding this comment

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

See my comments.

Additionally, a proper description of the pull-request is needed. The title isn't clear either. What does it mean?

@@ -1,57 +0,0 @@
#!/bin/sh
Copy link
Contributor

Choose a reason for hiding this comment

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

This file shouldn't have been removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding it back now.

@@ -99,13 +99,16 @@ static int serveDatasetContents(HttpService *service, HttpResponse *response){
respondWithDataset(response, filename, TRUE);
}
else if (!strcmp(request->method, methodPOST)){
/* this section is WIP to allow saving of members when another user
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be part of the pull-request if it's WIP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think that comment came from me. That ELSE block AT LINE 101 contains the same code as staging, apart from the comment, so I guess someone else removed the comment. I did add the EOL comments for my own interest on lines 106+107, but I made no other change to that ELSE block

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that comment came from me.

Al the commits in this pull-request belong to you. I don't see who else could have added this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're right, the comment is mine. Now I remember. I added it as a placeholder to remind me that there was a problem to be fixed. So the comment refers to code I've not written yet.

The problem is, if a user has the PDS directory open, the POST code at line 101 won't work. This is because the POST accesses the dataset via USS. If you try it yourself at the USS command prompt, you will find that writing to a member of that PDS won't work while the directory is open.

I have a solution for this, but I've not had time to finalise it.

Copy link
Member

Choose a reason for hiding this comment

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

hopefully removed extraneous comments

zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_DEBUG, "Updating if exists: %s\n", filename);
fflush(stdout);
updateDataset(response, filename, TRUE);
updateDataset(response, filename, TRUE);
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't add trailing space.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's harmless in C. If there's a formatting standard, then we should have a code formatter to fix this sort of thing. Saves time.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a change that does nothing. We shouldn't commit trailing spaces.

The rule of thumb is to use the same style as the rest of the file.

Comment on lines 146 to 148
zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_DEBUG2, "begin %s\n", __FUNCTION__);

zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_DEBUG2, "%s\n", __FUNCTION__);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 2 almost identical calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the 2nd one.

char *filenamep1 = stringConcatenate(response->slh, "//'", percentDecoded);
char *filename = stringConcatenate(response->slh, filenamep1, "'");
zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_DEBUG, "Taking enqueue on: %s\n", filename);
fflush(stdout);
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need fflush with zowelog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood; I'll remove the 2 I added. There are another 6 instances in that C file. I'm happy to remove them too.

Comment on lines +162 to +165
char *l1 = stringListPrint(request->parsedFile, 1, 1, "/", 0);
char *percentDecoded = cleanURLParamValue(response->slh, l1);
char *filenamep1 = stringConcatenate(response->slh, "//'", percentDecoded);
char *filename = stringConcatenate(response->slh, filenamep1, "'");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can any of these be NULL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting question and good spot of a potential error case.

These 4 lines are used by serveDatasetContents, serveDatasetEnqueue (my new function) and serveVSAMDatasetContents, when the logic requires the DSN to be wrapped in the format //'dsn' for use by USS. If either of my 2 usages of these 4 lines produces an error, then so could the other 4 uses in serveDatasetContents and serveVSAMDatasetContents.

This error can only happen with the API, since the file editor always ensures that the DSN is not null. I don't know if the API will catch that before it gets to this C program.

I'd like @struga0258 to create a test for this case. If that test fails, then I suggest we create a new issue and fix it at that stage.

Copy link
Member

Choose a reason for hiding this comment

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

unchanged from original, need to review again, so far didnt encounter any error here, will ned to check edge cases like sending empty filename etc

@@ -194,6 +247,19 @@ void installDatasetContentsService(HttpServer *server) {
registerHttpService(server, httpService);
}

/* new */
Copy link
Contributor

Choose a reason for hiding this comment

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

Bad comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gone.

zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_DEBUG, "Returning from %s\n", __FUNCTION__);
return 0;
}
/* end of new for ENQ */
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to comment obvious things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gone.

c/zis/build.sh Outdated
@@ -88,7 +88,7 @@ as "${ASFLAGS[@]}" -aegimrsx=nwm.asm nwm.s
as "${ASFLAGS[@]}" -aegimrsx=secmgmt.asm secmgmt.s
as "${ASFLAGS[@]}" -aegimrsx=snarfer.asm snarfer.s

export _LD_SYSLIB="//'SYS1.CSSLIB'://'CEE.SCEELKEX'://'CEE.SCEELKED'://'CEE.SCEERUN'://'CEE.SCEERUN2'://'CSF.SCSFMOD0'"
export _LD_SYSLIB="//'SYS1.CSSLIB'://'CEE.SCEELKEX'://'CEE.SCEELKED'://'CEE.SCEERUN'://'CEE.SCEERUN2'://'PP.CSF.ZOS203.SCSFMOD0'"
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't have been changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right; it was for the local build. I will revert it.

c/zss.c Outdated
@@ -666,6 +666,7 @@ static WebPluginListElt* readWebPluginDefinitions(HttpServer *server, ShortLived
}
int pluginLogLevel = checkLoggingVerbosity(serverConfigFile, identifier, slh);
if (identifier && pluginLocation) {
zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_WARNING, "Plugin ID '%s' is being loaded.\n", identifier); /* debug */
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you still need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted.

@ifakhrutdinov
Copy link
Contributor

ifakhrutdinov commented Dec 9, 2020

@John-A-Davies, all the code changes (including cleanup) are supposed to be completed when a pull-request is open. Please convert it to a draft if you expect more work.
image

John-A-Davies and others added 11 commits January 20, 2021 17:32
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
refactor semaphore and address feedback
Nakul Manchanda added 28 commits March 11, 2021 01:37
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
@1000TurquoisePogs
Copy link
Member

Thank you all for your work on pessimistic locking approach to writing datasets.
At this time we've merged optimistic locking (#355) as the pros-cons of it turned out favorable compared to pessimistic. We may come back to pessimistic locking if needed but for now I'm going to close such tickets and perhaps we'll revisit them.

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.

6 participants