cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

Add metadata to External Storage Placeholder File

Open andy-gxpaasio opened this issue 1 year ago • 5 comments

Issue When looking at an AWS S3 bucket that has been configured as an external connection I don't have an easy to way to know what database is writing to the location.

Observation I can see there is a sentinel file written but according to the source code the purpose of that file is only for the purpose of a sanity check but it doesn't actually use the file for anything beyond that.

In the code there is the line markerContent := "a CockroachDB cluster has been configured to read and write to this location"

Idea Instead of simply writing a dummy string why not write some useful metadata to the file to help with troubleshooting long term if someone is trying to diagnose an issue with an external connection and wants to check on the bucket side that the correct database(s) is/are pointing to the bucket.

  • for the name of the file add a UUID that represents the configured external connection so that if multiple connections use the same bucket (probably not a great idea but technically possible) you are aware that multiple external connections are writing to the same bucket. I do note that when using show create all external connections; a UUID isn't shown but I'm assuming there has to be some unique ID for each connection.
  • for the file contents dump extensive metadata about the instance of the database, cluster, folder, cloud tenant, etc. Basically whatever you can include in the file that would help with backwards traceability to figure out exactly what database is writing to this external storage connection. It would probably be ideal if it's a parsed format (JSON, YAML, etc.) but even having plain text would be an improvement.

Jira issue: CRDB-46826

andy-gxpaasio avatar Jan 25 '25 14:01 andy-gxpaasio

Hello, I am Blathers. I am here to help you get the issue triaged.

It looks like you have not filled out the issue in the format of any of our templates. To best assist you, we advise you to use one of these templates.

I was unable to automatically find someone to ping.

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

blathers-crl avatar Jan 25 '25 14:01 blathers-crl

cc @cockroachdb/disaster-recovery

blathers-crl avatar Jan 26 '25 01:01 blathers-crl

Hi @andy-gxpaasio , are you trying to validate that your external connection is valid? Have you tried looking at https://www.cockroachlabs.com/docs/v25.3/check-external-connection? Additionally, are you trying to validate whether this is an issue with your cluster connection or with individual databases?

alicia-l2 avatar Sep 23 '25 05:09 alicia-l2

Hi @alicia-l2 actually I am looking in the other direction. For any given S3 bucket where I am storing backups it could be very useful if I was able to index it and know what database it is backing up, when the last backup occurred etc. One use case would be a third party verification that backups are occuring, beyond just trusting the database itself. Another use case might be if you were to completely lose a database or entire cluster. You would have good information in the buckets(s) about where you might find the last backup and when that backup occurred. If everything is normal and healthy there might not be much utility. But under abnormal conditions it could be a lifesaver.

With that said when I am creating buckets and folders in those buckets I use a systemic naming convention from my IAC scripts so I know what clusters and databases are backing up to a location, but I don't necessarily have an easy and obvious way to confirm the latest backups beyond inferring from file timestamps.

arobinsongit avatar Sep 23 '25 13:09 arobinsongit

@arobinsongit Have you looked into SHOW BACKUPs, which lists backup in a directory and subdirectory? https://www.cockroachlabs.com/docs/stable/show-backup

Additionally, our cloud.write_bytes and cloud.read_bytes provide some information that the backup is occurring -- it is a log that emits how much data is being written/read from the S3 bucket during backup/restore respectively. https://www.cockroachlabs.com/docs/stable/cluster-virtualization-metric-scopes#metrics-scoped-to-a-virtual-cluster

Let me know if this doesn't help, happy to discuss further.

alicia-l2 avatar Oct 06 '25 14:10 alicia-l2