clintropolis commented on code in PR #19830:
URL: https://github.com/apache/druid/pull/19830#discussion_r3846436743
##########
extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/sync/CatalogClient.java:
##########
@@ -105,23 +107,58 @@ public ResolvedTable resolveTable(TableId id)
/**
* Creates a table for the given {@link TableId} and {@link TableSpec}.
* If a table already exists for this id, it is overwritten.
- * <p>
- * This method is currently used only in tests.
*/
public void createTable(TableId tableId, TableSpec tableSpec)
{
- getResult(postCreateTable(tableId, tableSpec));
+ getResult(postCreateTable(tableId, tableSpec, false, true));
+ }
+
+ /**
+ * Creates a table for the given {@link TableId} and {@link TableSpec}.
+ *
+ * @param ifNotExists leave an existing table alone rather than failing
+ * @param overwrite replace the spec of an existing table
+ */
+ public void createTable(TableId tableId, TableSpec tableSpec, boolean
ifNotExists, boolean overwrite)
+ {
+ FutureUtils.getUnchecked(postCreateTable(tableId, tableSpec, ifNotExists,
overwrite), true);
+ }
+
+ /**
+ * Applies an edit to an existing table's catalog entry.
+ * <p>
+ * API: {@code POST
/druid/coordinator/v1/catalog/schemas/{schema}/tables/{name}/edit}
+ */
+ public void editTable(TableId tableId, TableEditRequest editRequest)
+ {
+ String path = tablePath(TABLE_EDIT_PATH, tableId);
+ FutureUtils.getUnchecked(
+ serviceClient.asyncRequest(
Review Comment:
> producing conflicts or duplicate effects
I don't think this can really happen with the compare and set stuff, so
mainly the risk is a confusing error message? Re: idempotency, the SQL supports
IF NOT EXISTS/IF EXISTS, so i don't think we want it to be implicitly
idempotent.
Also this retrying isn't really new in this PR, createTable was already
going through it prior to this PR.. maybe in a follow-up we could consider
tightening up retry on write operations, since I think all it really gives us
is a more accurate error message?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]