From 5257bbe2b9b1cce5c15ca515bc640e9f75c4d7cd Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 24 Nov 2022 18:30:45 +0200 Subject: [PATCH] Remove information-free ".context" messages We capture stack traces of all errors, so these don't really add any value. As a thought experiment, if we had to add a line like this, with the function name in it, every time we use the ?-operator, we're doing something wrong. test_tenants.py::test_tenant_creation_fails creates a failpoint and checks that the error returned by the pageserver contains the failpoint name, and that was failing because it wasn't on the first line of the error. We should probably improve our error-scraping logic in the tests to not rely so heavily on string matching, but that's a different topic. FWIW, these are also pretty unlikely to fail in practice. --- pageserver/src/tenant_mgr.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pageserver/src/tenant_mgr.rs b/pageserver/src/tenant_mgr.rs index cb1529bfc5..73593bc48d 100644 --- a/pageserver/src/tenant_mgr.rs +++ b/pageserver/src/tenant_mgr.rs @@ -213,10 +213,9 @@ pub fn create_tenant( hash_map::Entry::Vacant(v) => { // Hold the write_tenants() lock, since all of this is local IO. // If this section ever becomes contentious, introduce a new `TenantState::Creating`. - let tenant_directory = super::tenant::create_tenant_files(conf, tenant_conf, tenant_id) - .context("create tenant files")?; - let created_tenant = load_local_tenant(conf, &tenant_directory, remote_storage) - .context("load created tenant")?; + let tenant_directory = + super::tenant::create_tenant_files(conf, tenant_conf, tenant_id)?; + let created_tenant = load_local_tenant(conf, &tenant_directory, remote_storage)?; match created_tenant { None => { // We get None in case the directory is empty.