Skip to content

Commit

Permalink
UI: check for start and end existence for qrep (#1652)
Browse files Browse the repository at this point in the history
For append and upsert modes in qrep, we need start and end placeholders
for partitioning. this PR adds validation and explanation text for this
<img width="1364" alt="Screenshot 2024-04-29 at 4 32 30 PM"
src="https://github.com/PeerDB-io/peerdb/assets/65964360/fb930449-07b8-4d06-b12a-b93faebccb3b">

---------

Co-authored-by: Kevin Biju <[email protected]>
  • Loading branch information
Amogh-Bharadwaj and heavycrystal authored Apr 30, 2024
1 parent 7866e79 commit 3dab1b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ui/app/mirrors/create/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,17 @@ export const handleCreateQRep = async (
return;
}

if (
!xmin &&
config.writeMode?.writeType != QRepWriteType.QREP_WRITE_MODE_OVERWRITE &&
!(query.includes('{{.start}}') && query.includes('{{.end}}'))
) {
notifyErr(
'Please include placeholders {{.start}} and {{.end}} in the query'
);
return;
}

if (xmin == true) {
config.watermarkColumn = 'xmin';
config.query = `SELECT * FROM ${quotedWatermarkTable(
Expand Down
5 changes: 5 additions & 0 deletions ui/app/mirrors/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ export default function CreateMirrors() {
Write a query whose results will be replicated to a target
table.
<br></br>
For append and upsert modes, make sure the query{' '}
<b>includes the start and end placeholders</b> in the query.
PeerDB uses these placeholders for partitioning query results
for performance.
<br></br>
In most cases, you will require a watermark table and a
watermark column in that table.
<br></br>
Expand Down

0 comments on commit 3dab1b3

Please sign in to comment.