-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
task_map: added task map scaling #10044
Open
leonardo-albertovich
wants to merge
7
commits into
master
Choose a base branch
from
leonardo-master-task_map_scaling_improvement
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b03ad45
config: modified task map to make its size flexible
leonardo-albertovich 2cc6c60
engine: updated task_map name to reflect the new name
leonardo-albertovich 9f51a8f
task: added task map growth
leonardo-albertovich cde719d
config: removed development aid
leonardo-albertovich 7658622
task: exposed internal function to improve testing
leonardo-albertovich 0c3b656
config: added missing error reporting
leonardo-albertovich 186ad66
build: test: added task map test
leonardo-albertovich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
|
||
#include <fluent-bit/flb_info.h> | ||
#include <fluent-bit/flb_mem.h> | ||
#include <fluent-bit/flb_error.h> | ||
#include <fluent-bit/flb_socket.h> | ||
#include <fluent-bit/flb_task.h> | ||
|
||
#include "flb_tests_internal.h" | ||
|
||
#define TASK_COUNT_LIMIT (FLB_CONFIG_DEFAULT_TASK_MAP_SIZE_LIMIT + 1) | ||
|
||
struct test_ctx { | ||
struct flb_config *config; | ||
}; | ||
|
||
struct test_ctx* test_ctx_create() | ||
{ | ||
struct test_ctx *ret_ctx = NULL; | ||
|
||
ret_ctx = flb_calloc(1, sizeof(struct test_ctx)); | ||
if (!TEST_CHECK(ret_ctx != NULL)) { | ||
flb_errno(); | ||
TEST_MSG("flb_malloc(test_ctx) failed"); | ||
return NULL; | ||
} | ||
|
||
ret_ctx->config = flb_config_init(); | ||
if(!TEST_CHECK(ret_ctx->config != NULL)) { | ||
TEST_MSG("flb_config_init failed"); | ||
flb_free(ret_ctx); | ||
return NULL; | ||
} | ||
|
||
return ret_ctx; | ||
} | ||
|
||
int test_ctx_destroy(struct test_ctx* ctx) | ||
{ | ||
if (!TEST_CHECK(ctx != NULL)) { | ||
return -1; | ||
} | ||
|
||
if (ctx->config) { | ||
flb_config_exit(ctx->config); | ||
} | ||
|
||
flb_free(ctx); | ||
return 0; | ||
} | ||
|
||
void test_task_map_limit() | ||
{ | ||
struct test_ctx *ctx; | ||
ssize_t index; | ||
struct flb_task *tasks[TASK_COUNT_LIMIT]; | ||
int failure_detected; | ||
|
||
ctx = test_ctx_create(); | ||
|
||
if (!TEST_CHECK(ctx != NULL)) { | ||
return; | ||
} | ||
|
||
failure_detected = FLB_FALSE; | ||
|
||
for (index = 0 ; index < TASK_COUNT_LIMIT ; index++) { | ||
tasks[index] = task_alloc(ctx->config); | ||
|
||
if (tasks[index] == NULL) { | ||
failure_detected = FLB_TRUE; | ||
|
||
break; | ||
} | ||
} | ||
|
||
if (TEST_CHECK(failure_detected == FLB_TRUE)) { | ||
TEST_CHECK(index == FLB_CONFIG_DEFAULT_TASK_MAP_SIZE_LIMIT); | ||
} | ||
|
||
while (index >= 0) { | ||
if (tasks[index] != NULL) { | ||
flb_task_destroy(tasks[index], FLB_TRUE); | ||
} | ||
index--; | ||
} | ||
|
||
test_ctx_destroy(ctx); | ||
} | ||
|
||
TEST_LIST = { | ||
{ "task_map_limit" , test_task_map_limit}, | ||
{ 0 } | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing flb_errno();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in commit 0c3b656