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

Support separation of catalog and compute #138

Closed
wants to merge 10 commits into from

Conversation

HuSen8891
Copy link
Collaborator

Change logs

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.

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

husen and others added 2 commits August 10, 2023 19:55
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
@CLAassistant
Copy link

CLAassistant commented Aug 10, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ HuSen8891
❌ husen


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.

Copy link

@github-actions github-actions bot left a 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!

@HuSen8891 HuSen8891 marked this pull request as draft August 10, 2023 12:03
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
Copy link
Contributor

Choose a reason for hiding this comment

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

CloudberryDB?

Copy link
Collaborator Author

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.

@@ -421,6 +427,17 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
/* Now we must recheck state from the top */
continue;
}
#ifdef SERVERLESS
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@@ -3130,6 +3148,15 @@ XLogBackgroundFlush(void)
TimestampTz now;
int flushbytes;

#ifdef SERVERLESS
Copy link
Contributor

Choose a reason for hiding this comment

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

Use hook?

Copy link
Collaborator Author

@HuSen8891 HuSen8891 Aug 11, 2023

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.

@@ -1608,6 +1608,14 @@ doQEDistributedExplicitBegin()
static bool
isDtxQueryDispatcher(void)
{
#ifdef SERVERLESS
Copy link
Contributor

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);

Copy link
Collaborator Author

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;
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

* 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)
Copy link
Contributor

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

husen and others added 4 commits August 11, 2023 17:44
…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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why change this ?

Copy link
Collaborator Author

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

i == n ?

Copy link
Collaborator Author

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

where release lock ?

Copy link
Collaborator Author

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.

@tuhaihe
Copy link
Member

tuhaihe commented Aug 29, 2023

Hi @HuSen8891 : Thanks for your contribution!

  1. Please use rebase instead of merge for your commits to stay up to date with the main branch.
  2. For a good commit title and message body, please follow our commit conventions and rewrite yours.
  3. Additionally, please remember to squash your commits down to one before your PR is merged.

Thanks again.

@HuSen8891
Copy link
Collaborator Author

Hi @HuSen8891 : Thanks for your contribution!

  1. Please use rebase instead of merge for your commits to stay up to date with the main branch.
  2. For a good commit title and message body, please follow our commit conventions and rewrite yours.
  3. Additionally, please remember to squash your commits down to one before your PR is merged.

Thanks again.

Thanks. I'll rebase the code and rewrite the commit message when the PR is ready.

@HuSen8891 HuSen8891 closed this Sep 6, 2023
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.

None yet

5 participants