[1/2] hadoop git commit: YARN-4245. Generalize config file handling in container-executor. Contributed by Sidharta Seethana.
Repository: hadoop Updated Branches: refs/heads/branch-2.7 29d969eff -> 1569cc62c YARN-4245. Generalize config file handling in container-executor. Contributed by Sidharta Seethana. (cherry picked from commit 8ed2e060e80c0def3fcb7604e0bd27c1c24d291e) (cherry picked from commit 78919f8c341ec645cf9134991e3ae89a929b9184) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/af3b37d0 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/af3b37d0 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/af3b37d0 Branch: refs/heads/branch-2.7 Commit: af3b37d0cc7628ab6020411720174e9936fc876a Parents: 29d969e Author: Andrew Purtell Authored: Mon Nov 12 20:52:47 2018 + Committer: Konstantin V Shvachko Committed: Wed Nov 28 16:49:00 2018 -0800 -- hadoop-yarn-project/CHANGES.txt | 17 ++- .../container-executor/impl/configuration.c | 124 ++- .../container-executor/impl/configuration.h | 28 - .../impl/container-executor.c | 23 +++- .../impl/container-executor.h | 13 +- .../main/native/container-executor/impl/main.c | 4 +- .../test/test-container-executor.c | 8 +- 7 files changed, 141 insertions(+), 76 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/af3b37d0/hadoop-yarn-project/CHANGES.txt -- diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index f32c656..d84719b 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -1,6 +1,21 @@ Hadoop YARN Change Log -elease 2.7.7 - 2018-07-18 +Release 2.7.8 - UNRELEASED + + INCOMPATIBLE CHANGES + + NEW FEATURES + + IMPROVEMENTS + +YARN-4245. Generalize config file handling in container-executor. +(Sidharta Seethana, Andrew Purtell via shv). + + OPTIMIZATIONS + + BUG FIXES + +Release 2.7.7 - 2018-07-18 INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/af3b37d0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c index 7645d86..1667b0d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c @@ -33,34 +33,22 @@ #define MAX_SIZE 10 -struct confentry { - const char *key; - const char *value; -}; - -struct configuration { - int size; - struct confentry **confdetails; -}; - -struct configuration config={.size=0, .confdetails=NULL}; - //clean up method for freeing configuration -void free_configurations() { +void free_configurations(struct configuration *cfg) { int i = 0; - for (i = 0; i < config.size; i++) { -if (config.confdetails[i]->key != NULL) { - free((void *)config.confdetails[i]->key); + for (i = 0; i < cfg->size; i++) { +if (cfg->confdetails[i]->key != NULL) { + free((void *)cfg->confdetails[i]->key); } -if (config.confdetails[i]->value != NULL) { - free((void *)config.confdetails[i]->value); +if (cfg->confdetails[i]->value != NULL) { + free((void *)cfg->confdetails[i]->value); } -free(config.confdetails[i]); +free(cfg->confdetails[i]); } - if (config.size > 0) { -free(config.confdetails); + if (cfg->size > 0) { +free(cfg->confdetails); } - config.size = 0; + cfg->size = 0; } /** @@ -137,8 +125,8 @@ int check_configuration_permissions(const char* file_name) { return 0; } -//function used to load the configurations present in the secure config -void read_config(const char* file_name) { + +void read_config(const char* file_name, struct configuration *cfg) { FILE *conf_file; char *line; char *equaltok; @@ -156,9 +144,9 @@ void read_config(const char* file_name) { #endif //allocate space for ten configuration items. - config.confdetails = (struct confentry **) malloc(sizeof(struct confentry *) + cfg->confdetails = (struct confentry **) malloc(sizeof(struct confentry *) * MAX_SIZE); - config.size = 0; + cfg->size = 0; conf_file = fopen(file_name, "r"); if (conf_file == NULL) { fprintf(ERRORFILE, "Invalid conf file provided : %s \n", file_name); @@ -200,9
[1/2] hadoop git commit: YARN-4245. Generalize config file handling in container-executor. Contributed by Sidharta Seethana.
Repository: hadoop Updated Branches: refs/heads/branch-2 e9a0ffc7f -> 78919f8c3 refs/heads/trunk e51a8c105 -> 8ed2e060e YARN-4245. Generalize config file handling in container-executor. Contributed by Sidharta Seethana. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8ed2e060 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8ed2e060 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8ed2e060 Branch: refs/heads/trunk Commit: 8ed2e060e80c0def3fcb7604e0bd27c1c24d291e Parents: e51a8c1 Author: Varun VasudevAuthored: Mon Mar 7 16:18:35 2016 +0530 Committer: Varun Vasudev Committed: Mon Mar 7 16:18:35 2016 +0530 -- .../container-executor/impl/configuration.c | 98 ++-- .../container-executor/impl/configuration.h | 28 +- .../impl/container-executor.c | 27 +- .../impl/container-executor.h | 13 ++- .../main/native/container-executor/impl/main.c | 4 +- .../test/test-container-executor.c | 8 +- 6 files changed, 112 insertions(+), 66 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8ed2e060/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c index 17cce75..3447524 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/configuration.c @@ -34,34 +34,22 @@ #define MAX_SIZE 10 -struct confentry { - const char *key; - const char *value; -}; - -struct configuration { - int size; - struct confentry **confdetails; -}; - -struct configuration config={.size=0, .confdetails=NULL}; - //clean up method for freeing configuration -void free_configurations() { +void free_configurations(struct configuration *cfg) { int i = 0; - for (i = 0; i < config.size; i++) { -if (config.confdetails[i]->key != NULL) { - free((void *)config.confdetails[i]->key); + for (i = 0; i < cfg->size; i++) { +if (cfg->confdetails[i]->key != NULL) { + free((void *)cfg->confdetails[i]->key); } -if (config.confdetails[i]->value != NULL) { - free((void *)config.confdetails[i]->value); +if (cfg->confdetails[i]->value != NULL) { + free((void *)cfg->confdetails[i]->value); } -free(config.confdetails[i]); +free(cfg->confdetails[i]); } - if (config.size > 0) { -free(config.confdetails); + if (cfg->size > 0) { +free(cfg->confdetails); } - config.size = 0; + cfg->size = 0; } /** @@ -133,8 +121,8 @@ int check_configuration_permissions(const char* file_name) { return 0; } -//function used to load the configurations present in the secure config -void read_config(const char* file_name) { + +void read_config(const char* file_name, struct configuration *cfg) { FILE *conf_file; char *line; char *equaltok; @@ -152,9 +140,9 @@ void read_config(const char* file_name) { #endif //allocate space for ten configuration items. - config.confdetails = (struct confentry **) malloc(sizeof(struct confentry *) + cfg->confdetails = (struct confentry **) malloc(sizeof(struct confentry *) * MAX_SIZE); - config.size = 0; + cfg->size = 0; conf_file = fopen(file_name, "r"); if (conf_file == NULL) { fprintf(ERRORFILE, "Invalid conf file provided : %s \n", file_name); @@ -196,9 +184,9 @@ void read_config(const char* file_name) { free(line); continue; } -config.confdetails[config.size] = (struct confentry *) malloc( +cfg->confdetails[cfg->size] = (struct confentry *) malloc( sizeof(struct confentry)); -if(config.confdetails[config.size] == NULL) { +if(cfg->confdetails[cfg->size] == NULL) { fprintf(LOGFILE, "Failed allocating memory for single configuration item\n"); goto cleanup; @@ -208,10 +196,10 @@ void read_config(const char* file_name) { fprintf(LOGFILE, "read_config : Adding conf key : %s \n", equaltok); #endif -memset(config.confdetails[config.size], 0, sizeof(struct confentry)); -config.confdetails[config.size]->key = (char *) malloc( +memset(cfg->confdetails[cfg->size], 0, sizeof(struct confentry)); +