From 55eb84b004846c651dce9bec3ecc48f98ff18671 Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Mon, 29 Apr 2024 16:33:48 +0530 Subject: [PATCH 1/2] check for start and end existence --- ui/app/mirrors/create/handlers.ts | 10 ++++++++++ ui/app/mirrors/create/page.tsx | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/ui/app/mirrors/create/handlers.ts b/ui/app/mirrors/create/handlers.ts index 1d76c3196e..90ade99ff4 100644 --- a/ui/app/mirrors/create/handlers.ts +++ b/ui/app/mirrors/create/handlers.ts @@ -211,6 +211,16 @@ export const handleCreateQRep = async ( return; } + if ( + 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( diff --git a/ui/app/mirrors/create/page.tsx b/ui/app/mirrors/create/page.tsx index ed70c33b1e..2b0f59d33e 100644 --- a/ui/app/mirrors/create/page.tsx +++ b/ui/app/mirrors/create/page.tsx @@ -191,6 +191,11 @@ export default function CreateMirrors() { Write a query whose results will be replicated to a target table.

+ For append and upsert modes, make sure the query{' '} + includes the start and end placeholders in the query. + PeerDB uses these placeholders for partitioning query results + for performance. +

In most cases, you will require a watermark table and a watermark column in that table.

From c96b1bb134d6663dd738aba931c65570018efba3 Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Mon, 29 Apr 2024 23:01:50 +0530 Subject: [PATCH 2/2] do it for qrep, not xmin --- ui/app/mirrors/create/handlers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/app/mirrors/create/handlers.ts b/ui/app/mirrors/create/handlers.ts index 90ade99ff4..6b808fedbc 100644 --- a/ui/app/mirrors/create/handlers.ts +++ b/ui/app/mirrors/create/handlers.ts @@ -212,6 +212,7 @@ export const handleCreateQRep = async ( } if ( + !xmin && config.writeMode?.writeType != QRepWriteType.QREP_WRITE_MODE_OVERWRITE && !(query.includes('{{.start}}') && query.includes('{{.end}}')) ) {