diff --git a/compute_tools/src/extension_server.rs b/compute_tools/src/extension_server.rs index 36c348d76a..3bf925e527 100644 --- a/compute_tools/src/extension_server.rs +++ b/compute_tools/src/extension_server.rs @@ -44,12 +44,16 @@ We only upload a new one if it is updated. More specifically, here is an example ext_index.json { "embedding": { - "control_file_content": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true", - "extension_archive": "111/v14/extensions/embedding.tar.zst" + "control_data": { + "embedding.control": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true" + }, + "archive_path": "111/v15/extensions/embedding.tar.zst" }, "anon": { - "control_file_content": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n", - "extension_archive": "111/v14/extensions/anon.tar.zst" + "control_data": { + "anon.control": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n" + }, + "archive_path": "111/v15/extensions/anon.tar.zst" } } */ @@ -131,14 +135,18 @@ pub async fn get_available_extensions( let ext_data = ext_index_full[extension] .as_object() .context("error parsing json")?; - let control_contents = ext_data["control_file_content"] - .as_str() - .context("error parsing json")?; - let control_path = local_sharedir.join(extension.to_owned() + ".control"); - info!("writing file {:?}{:?}", control_path, control_contents); - file_create_tasks.push(tokio::fs::write(control_path, control_contents)); - let ext_archive_path = ext_data["extension_archive"] + let control_files = ext_data["control_data"] + .as_object() + .context("error parsing json")?; + for (control_file, control_contents) in control_files { + let control_path = local_sharedir.join(control_file); + let control_contents_str = control_contents.as_str().context("error parsing json")?; + info!("writing file {:?}{:?}", control_path, control_contents); + file_create_tasks.push(tokio::fs::write(control_path, control_contents_str)); + } + + let ext_archive_path = ext_data["archive_path"] .as_str() .context("error parsing json")?; ext_remote_paths.insert( diff --git a/docs/rfcs/024-extension-loading.md b/docs/rfcs/024-extension-loading.md index f775e3372c..81bf3f8652 100644 --- a/docs/rfcs/024-extension-loading.md +++ b/docs/rfcs/024-extension-loading.md @@ -180,16 +180,20 @@ We do not duplicate `extension.tar.zst` files. We only upload a new one if it is updated. **access** is controlled by spec -More specifically, here is an example `ext_index.json` +More specifically, here is an example `ext_index.json` that could be found in `111/v14` ``` { "embedding": { - "control_file_content": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true", - "extension_archive": "111/v14/extensions/embedding.tar.zst" + "control_data": { + "embedding.control": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true" + }, + "archive_path": "111/v15/extensions/embedding.tar.zst" }, "anon": { - "control_file_content": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n", - "extension_archive": "111/v14/extensions/anon.tar.zst" + "control_data": { + "anon.control": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n" + }, + "archive_path": "111/v15/extensions/anon.tar.zst" } } ``` diff --git a/test_runner/regress/data/extension_test/111/v14/ext_index.json b/test_runner/regress/data/extension_test/111/v14/ext_index.json index b5365ceea0..f0c0b0cefb 100644 --- a/test_runner/regress/data/extension_test/111/v14/ext_index.json +++ b/test_runner/regress/data/extension_test/111/v14/ext_index.json @@ -1,10 +1,15 @@ { "embedding": { - "control_file_content": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true", - "extension_archive": "111/v14/extensions/embedding.tar.zst" + "control_data": { + "embedding.control": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true" + }, + "archive_path": "111/v14/extensions/embedding.tar.zst" }, "anon": { - "control_file_content": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n", - "extension_archive": "111/v14/extensions/anon.tar.zst" + "control_data": { + "anon.control": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n" + }, + "archive_path": "111/v14/extensions/anon.tar.zst" } } + diff --git a/test_runner/regress/data/extension_test/111/v15/ext_index.json b/test_runner/regress/data/extension_test/111/v15/ext_index.json index acd631accb..b5a6f4dd4d 100644 --- a/test_runner/regress/data/extension_test/111/v15/ext_index.json +++ b/test_runner/regress/data/extension_test/111/v15/ext_index.json @@ -1,11 +1,14 @@ { "embedding": { - "control_file_content": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true", - "extension_archive": "111/v15/extensions/embedding.tar.zst" + "control_data": { + "embedding.control": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true" + }, + "archive_path": "111/v15/extensions/embedding.tar.zst" }, "anon": { - "control_file_content": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n", - "extension_archive": "111/v15/extensions/anon.tar.zst" + "control_data": { + "anon.control": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n" + }, + "archive_path": "111/v15/extensions/anon.tar.zst" } } - diff --git a/test_runner/regress/data/extension_test/112/v14/ext_index.json b/test_runner/regress/data/extension_test/112/v14/ext_index.json deleted file mode 100644 index 3384d733f1..0000000000 --- a/test_runner/regress/data/extension_test/112/v14/ext_index.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "embedding": { - "control_file_content": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true", - "extension_archive": "111/v14/extensions/embedding.tar.zst" - }, - "anon": { - "control_file_content": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n", - "extension_archive": "112/v14/extensions/anon.tar.zst" - } -} diff --git a/test_runner/regress/data/extension_test/112/v14/extensions/anon.tar.zst b/test_runner/regress/data/extension_test/112/v14/extensions/anon.tar.zst deleted file mode 100644 index 24a08ec9aa..0000000000 Binary files a/test_runner/regress/data/extension_test/112/v14/extensions/anon.tar.zst and /dev/null differ diff --git a/test_runner/regress/data/extension_test/112/v15/ext_index.json b/test_runner/regress/data/extension_test/112/v15/ext_index.json deleted file mode 100644 index a73cba0523..0000000000 --- a/test_runner/regress/data/extension_test/112/v15/ext_index.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "embedding": { - "control_file_content": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true", - "extension_archive": "111/v15/extensions/embedding.tar.zst" - }, - "anon": { - "control_file_content": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n", - "extension_archive": "112/v15/extensions/anon.tar.zst" - } -} - diff --git a/test_runner/regress/data/extension_test/112/v15/extensions/anon.tar.zst b/test_runner/regress/data/extension_test/112/v15/extensions/anon.tar.zst deleted file mode 100644 index 045d7be049..0000000000 Binary files a/test_runner/regress/data/extension_test/112/v15/extensions/anon.tar.zst and /dev/null differ diff --git a/test_runner/regress/data/extension_test/113/v14/ext_index.json b/test_runner/regress/data/extension_test/113/v14/ext_index.json deleted file mode 100644 index 6a54e78322..0000000000 --- a/test_runner/regress/data/extension_test/113/v14/ext_index.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "embedding": { - "control_file_content": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true", - "extension_archive": "113/v14/extensions/embedding.tar.zst" - }, - "anon": { - "control_file_content": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n", - "extension_archive": "111/v14/extensions/anon.tar.zst" - } -} diff --git a/test_runner/regress/data/extension_test/113/v14/extensions/embedding.tar.zst b/test_runner/regress/data/extension_test/113/v14/extensions/embedding.tar.zst deleted file mode 100644 index f522afc742..0000000000 Binary files a/test_runner/regress/data/extension_test/113/v14/extensions/embedding.tar.zst and /dev/null differ diff --git a/test_runner/regress/data/extension_test/113/v15/ext_index.json b/test_runner/regress/data/extension_test/113/v15/ext_index.json deleted file mode 100644 index f193cff9d2..0000000000 --- a/test_runner/regress/data/extension_test/113/v15/ext_index.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "embedding": { - "control_file_content": "comment = 'hnsw index' \ndefault_version = '0.1.0' \nmodule_pathname = '$libdir/embedding' \nrelocatable = true \ntrusted = true", - "extension_archive": "113/v15/extensions/embedding.tar.zst" - }, - "anon": { - "control_file_content": "# PostgreSQL Anonymizer (anon) extension \ncomment = 'Data anonymization tools' \ndefault_version = '1.1.0' \ndirectory='extension/anon' \nrelocatable = false \nrequires = 'pgcrypto' \nsuperuser = false \nmodule_pathname = '$libdir/anon' \ntrusted = true \n", - "extension_archive": "111/v15/extensions/anon.tar.zst" - } -} - diff --git a/test_runner/regress/data/extension_test/113/v15/extensions/embedding.tar.zst b/test_runner/regress/data/extension_test/113/v15/extensions/embedding.tar.zst deleted file mode 100644 index f33fd48a66..0000000000 Binary files a/test_runner/regress/data/extension_test/113/v15/extensions/embedding.tar.zst and /dev/null differ