@gscdump/lakehouse 0.35.12 → 0.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,8 +123,15 @@ async function connectIcebergCatalog(config, opts = {}) {
123
123
  function catalogCacheScope(config) {
124
124
  return `${config.catalogUri}\0${config.warehouse}`;
125
125
  }
126
+ function isNamespaceAlreadyExistsError(err) {
127
+ if (err && typeof err === "object" && err.status === 409) return true;
128
+ const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();
129
+ return msg.includes("already exists") || msg.includes("409") || msg.includes("conflict");
130
+ }
126
131
  async function ensureIcebergNamespace(conn) {
127
- await restCatalogCreateNamespace(conn.catalog, { namespace: conn.namespace }).catch(() => {});
132
+ await restCatalogCreateNamespace(conn.catalog, { namespace: conn.namespace }).catch((err) => {
133
+ if (!isNamespaceAlreadyExistsError(err)) throw err;
134
+ });
128
135
  }
129
136
  async function listIcebergTables(conn) {
130
137
  return (await restCatalogListTables(conn.catalog, { namespace: conn.namespace })).map((t) => t.name).sort();
@@ -171,12 +178,13 @@ async function icebergAppendRetrying(args, options = {}) {
171
178
  [APPEND_ID_SUMMARY_KEY]: appendId
172
179
  }
173
180
  };
174
- if (await appendAlreadyLanded(args, appendId).catch(() => false)) return;
181
+ if (await appendAlreadyLanded(args, appendId)) return;
175
182
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
176
183
  const err = await icebergAppend(stampedArgs).then(() => void 0, (e) => e);
177
184
  if (err === void 0) return;
178
- if (await appendAlreadyLanded(args, appendId).catch(() => false)) return;
179
- if (!isCommitRateLimited(err) || attempt === maxAttempts - 1) throw err;
185
+ if (!isCommitRateLimited(err)) throw err;
186
+ if (await appendAlreadyLanded(args, appendId)) return;
187
+ if (attempt === maxAttempts - 1) throw err;
180
188
  const ceiling = Math.min(maxDelayMs, baseDelayMs * 2 ** attempt);
181
189
  await sleep(Math.floor(random() * ceiling));
182
190
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/lakehouse",
3
3
  "type": "module",
4
- "version": "0.35.12",
4
+ "version": "0.36.1",
5
5
  "description": "Dataset-agnostic Iceberg lakehouse layer + dataset registry for R2 Data Catalog producers (ADR-0021).",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",