DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
For queries contains dynamic parameters it need to have a possibility to map partition aware involved columns into direct node. Let`s use some kind of piggybacking (or probably lazy) approach to delivery such a mapping i.e. lets send first request(s) into any possible node (as it was without partition awareness implementation) and obtain such mapping with first response. In the case when query response contains partition aware metadata it need to be cached directly into size bounded
Map<PaCacheKey, PartitionAwarenessMetadata> structure where PaCacheKey represents schema and query with additional pre-calculated hash for further comparing boosting. It's worth mentioning that such approach will give different resolving for equivalent queries like:
...
Additionally lightweight client tx coordination [2] need to be applicable together with partition aware request mapping. Lets use simple approach at first time: if affinity meta mapping is found from cache - direct mode is used and proxy otherwise. Another words: if modified rows are belongs to only one node - direct mode is used.
Protocol changes: if server side client request handler detects that PA feature supported it need to prepare PA structure (if possible) and send it back to the client.
Client protocol changes:
Let`s consider the scope of use cases this improvement can be applied to:
...
| Code Block | ||
|---|---|---|
| ||
CREATE TABLE T (
id int,
col1 int DEFAULT -1,
col2 int,
PRIMARY KEY(id, col1, col2))
COLOCATE BY(col1, col2)
) |
// Describe project risks, such as API or binary compatibility issues, major protocol changes, etc.
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
// Colocation column values passed via params
INSERT INTO T (id, col1, col2) VALUES(1, ?, ?);
// Colocation column values partially passed via literals
INSERT INTO T (id, col1, col2) VALUES(1, ?, 100);
INSERT INTO T (id, col2) VALUES(?, 100), (?, 200); |
| Code Block | ||||
|---|---|---|---|---|
| ||||
// Pure dynamic parameters
SELECT * FROM T WHERE col1 = ? AND col2 = ?;
// Colocation column values partially passed via literals
SELECT * FROM T WHERE col1 = ? AND col2 = 100;
SELECT * FROM T WHERE col1 = ? AND col2 = (SELECT 1);
// Colocation column values completely passed via literals
SELECT * FROM T WHERE col1 = 0 AND col2 = 100;
|
Applicabilityfor Delete, Update and Merge statements - need to be the same as for SELECT above.
Not applicable cases:
| Code Block | ||||
|---|---|---|---|---|
| ||||
SELECT * FROM T WHERE col1 = ? AND col2 = (SELECT MIN(a) FROM T2); |
| Code Block | ||||
|---|---|---|---|---|
| ||||
INSERT INTO T (id, col2) VALUES(0, '100'::INTEGER); |
| Code Block | ||||
|---|---|---|---|---|
| ||||
INSERT INTO T SELECT * FROM T2 WHERE condition; |
[1] IEP-95: Client Partition Awareness
...
| Jira | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|