-
Notifications
You must be signed in to change notification settings - Fork 59
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
Support separation of catalog and compute #138
Conversation
core changes: 1. add macro serverless, configure with --enable-serverless 2. add hooks to get control in transaction/dispatch management 3. add transaction processing framework 4. add session state dispatch framework
husen seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
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.
Hiiii, @HuSen8891 welcome!🎊 Thanks for taking the effort to make our project better! 🙌 Keep making such awesome contributions!
configure
Outdated
@@ -1604,6 +1606,7 @@ Optional Features: | |||
--enable-cassert enable assertion checks (for debugging) | |||
--disable-orca disable ORCA optimizer | |||
--enable-catalog-ext enable CloudberryDB catalog extension | |||
--enable-serverless use Cloudberry serverless architecture |
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.
CloudberryDB?
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.
I'll fix it later.
src/backend/access/transam/slru.c
Outdated
@@ -421,6 +427,17 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok, | |||
/* Now we must recheck state from the top */ | |||
continue; | |||
} | |||
#ifdef SERVERLESS |
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.
Better to add a hook for LRUPageRead?
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.
add SimpleLruReadPage_hook for plugin to read SLRU page.
src/backend/access/transam/xlog.c
Outdated
@@ -3130,6 +3148,15 @@ XLogBackgroundFlush(void) | |||
TimestampTz now; | |||
int flushbytes; | |||
|
|||
#ifdef SERVERLESS |
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.
Use hook?
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.
remove this later,add whitelist function to avoid launching WalWriter.
src/backend/cdb/cdbtm.c
Outdated
@@ -1608,6 +1608,14 @@ doQEDistributedExplicitBegin() | |||
static bool | |||
isDtxQueryDispatcher(void) | |||
{ | |||
#ifdef SERVERLESS |
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.
Add a guc to control?
For example:
return (Gp_role == GP_ROLE_DISPATCH &&
isDtmStarted &&
isSharedLocalSnapshotSlotPresent);
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.
add global variable enable_serverless, default to false, set to true in plugin.
/* | ||
* Hook for plugins to get control in AutoVacLauncher. | ||
*/ | ||
AutoVacLauncherMain_hook_type AutoVacLauncherMain_hook = NULL; |
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.
Provide a whitelist/blacklist so that we could control what background worker processes start?
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.
Add whitelist function for auxiliary/background process.
src/backend/storage/buffer/bufmgr.c
Outdated
* The page in buffer may be out of date, we need to check the buffer | ||
* and refresh the buffer if the page has been modified. | ||
*/ | ||
if (Gp_role == GP_ROLE_EXECUTE && valid) |
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.
Need to think again about mechanism on the page consistent between QD and QE
…ue in plugin. 2. add SimpleLruReadPage_hook for plugin to read SLRU page. 3. add StartChildProcess_hook for plugin to get control in child process startup.
…n catalog is permitted on single master without warehouse.
Currently, we use randomly distribution for hashdata table, and the number of segments is set to 0. When we query on hashdata table, the distribution policy's segment number is set to number of segments of current warehouse.
@@ -458,8 +458,16 @@ GpPolicyFetch(Oid tbloid) | |||
} | |||
|
|||
/* Create a GpPolicy object. */ | |||
policy = makeGpPolicy(POLICYTYPE_PARTITIONED, | |||
nattrs, policyform->numsegments); | |||
if (policyform->numsegments == 0) |
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.
why change this ?
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.
We support to create table on single master without any segments. We create segments through creating warehouse on single master, switch to warehouse and query.
totalLen += sizeof(int) + strlen(names[i]) + 1 + *(lengths + i); | ||
i++; | ||
} | ||
Assert(i = n); |
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.
i == n ?
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.
Yes, let me fix this.
if (SimpleLruReadPage_hook) | ||
{ | ||
LWLockAcquire(shared->ControlLock, LW_EXCLUSIVE); | ||
return (*SimpleLruReadPage_hook) (ctl, pageno, true, xid); |
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.
where release lock ?
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.
Lock released by the caller.
Hi @HuSen8891 : Thanks for your contribution!
Thanks again. |
Thanks. I'll rebase the code and rewrite the commit message when the PR is ready. |
Change logs
core changes:
Why are the changes needed?
Describe why the changes are necessary.
Does this PR introduce any user-facing change?
If yes, please clarify the previous behavior and the change this PR proposes.
How was this patch tested?
Please detail how the changes were tested, including manual tests and any relevant unit or integration tests.
Contributor's Checklist