f518e03d8f56af784ec14536a7bdc0daed9a38fd chmalee Wed Sep 16 11:11:32 2026 -0700 Send each file's genome with a hubtools upload so hubSpace rows get a db, and stop the server rewriting a user-uploaded hub.txt, no redmine Co-Authored-By: Claude Opus 5 (1M context) diff --git src/hg/inc/userdata.h src/hg/inc/userdata.h index f49fe48a6c2..71abdd9c702 100644 --- src/hg/inc/userdata.h +++ src/hg/inc/userdata.h @@ -99,35 +99,37 @@ void createNewTempHubForUpload(char *requestId, struct hubSpace *rowForFile, char *userDataDir); /* Creates a hub.txt for this upload, and updates the hubSpace table for the * hub.txt and any parentDirs we need to create. */ boolean userHasOwnNamedHubTxtInDir(char *userName, char *hubName, char *hubDir); /* Return TRUE if the user uploaded a *.hub.txt file NOT literally named 'hub.txt' * (e.g. 'araTha1.hub.txt') at the top level of hubDir. Distinguishes "user's own * authoritative hub.txt" from "backend-synthesized hub.txt that we're free to modify". * parentDir alone would also match a *.hub.txt sitting in some other hub's * subdirectory that happens to be named hubName, so pin it to hubDir as well */ char *existingHubTypeForDir(char *userName, char *hubName); /* Return the hubType of this user's hub dir row, or NULL if no such row exists. */ -void upgradeExistingHubToAssembly(struct hubSpace *rowForFile, char *userDataDir); -/* Race-proofing: when a 2bit arrives into a hub that already has a synthesized - * hub.txt, upgrade that hub.txt to include the assembly stanza and mark every - * hubSpace row for this hub as hubType='assemblyHub'. No-op unless rowForFile - * is a 2bit, or the synthesized hub.txt does not exist. */ +void upgradeExistingHubToAssembly(struct hubSpace *rowForFile, char *userDataDir, + boolean backendOwnsHubTxt); +/* When a 2bit arrives into a hub, mark every hubSpace row for this hub as + * hubType='assemblyHub'. When backendOwnsHubTxt, first add the assembly stanza to + * the synthesized hub.txt, which is itself a no-op if that file does not exist. + * Pass FALSE for a hub.txt the user uploaded, whose contents are theirs to write. + * The whole function is a no-op unless rowForFile is a 2bit. */ int lockHubDir(char *hubDir); /* Acquire an exclusive flock on hubDir/.hub.lock; returns a file descriptor. * Hold while mutating hub.txt to serialize parallel pre-finish processes. */ void unlockHubDir(int fd); /* Release an exclusive hub lock acquired by lockHubDir. */ void addHubSpaceRowForFile(struct hubSpace *row); /* We created a file for a user, now add an entry to the hubSpace table for it */ void makeParentDirRows(char *userName, time_t lastModified, char *db, char *parentDirStr, char *userDataDir, char *hubType); /* For each '/' separated component of parentDirStr, create a row in hubSpace. Return the * final subdirectory component of parentDirStr */