Sidecar SYNC does not refresh GPS after external XMP restore (DB stale after touch + Extract)
### I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.
- [x] Yes
### The bug
I hit #23074. Manage Location with shift-select moved around 15k photos to the wrong location.
I restored the sidecars externally from a ZFS snapshot that has the correct data. On disk they are now correct again. Where an XMP existed before it now shows the old correct GPS, where there was no XMP before there is no XMP now. I checked with `grep GPSLatitude` on a few files and it looks right.
The database didn't follow. I ran Admin -> Jobs -> Sidecar SYNC, it queued Extract Metadata for about 70k assets and finished. The map and the DB still show 15373 at the wrong location. I checked with `select count(*) from asset_exif where latitude = <bad> and longitude = <bad>` and it's still 15373.
I thought it was mtime, so I touched all the sidecars and the images to bump the time and ran SYNC again. Same result after it finished. Files on disk are good, `asset_exif` is still stale.
I expected SYNC to re-read the XMP and overwrite the DB. It doesn't. This feels related to #13897 and #20352.
### The OS that Immich Server is running on
Ubuntu 24.04.3 LTS (6.8.0-110-generic)
### Version of Immich Server
v3 (ghcr.io/immich-app/immich-server:v3)
### Version of Immich Mobile App
Not used for this bug
### Platform with the issue
- [x] Server
- [x] Web
- [ ] Mobile
### Device make and model
Server ASUS-PB62, browser on Mac
### Your docker-compose.yml content
```yaml
name: immich
services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
volumes:
- ${UPLOAD_LOCATION}:/data
- ${THUMB_LOCATION}:/data/thumbs
- ${ENCODED_VIDEO_LOCATION}:/data/encoded-video
- ${PROFILE_LOCATION}:/data/profile
env_file:
- stack.env
depends_on:
- redis
- database
restart: always
redis:
container_name: immich_redis
image: docker.io/valkey/valkey:9
database:
container_name: immich_postgres
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
volumes:
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
```
### Your .env content
```shell
IMMICH_VERSION=v3
DB_DATABASE_NAME=immich
TZ=Europe/Skopje
UPLOAD_LOCATION=/tank/DOCKER_DATA/immich/upload
THUMB_LOCATION=/home/antonio/DOCKER_DATA/immich/thumbs
```
### Reproduction steps
1. Bulk-edit GPS via Manage Location (or set ~15k assets to the same wrong location)
2. Restore the XMP sidecars externally from a good snapshot and verify on disk they are correct
3. Touch the sidecars/images to bump mtime
4. Run Admin -> Jobs -> Sidecar SYNC and wait for Extract Metadata to finish
5. Check DB: `select count(*) from asset_exif where latitude = <bad>` - still shows the old count
### Relevant log output
_No response_
### Additional information
Happy to provide a sample XMP or DB row. Original disaster from #23074.
<img width="827" height="357" alt="Image" src="https://github.com/user-attachments/assets/92eedfc0-34fe-46c1-8b86-21593b30400c" />
<img width="1268" height="705" alt="Image" src="https://github.com/user-attachments/assets/bfe212ff-0d8c-499a-b85a-29f6283c32c1" />
and here is the DB data for the particular video with the sidecar file for it:
```
antonio@asus:/tank/DOCKER_DATA/immich/upload$ docker exec immich_postgres psql -U casaos -d immich -t -A -c "SELECT e.\"latitude\", e.\"longitude\" FROM asset a JOIN asset_exif e ON a.id=e.\"assetId\" WHERE a.\"originalPath\" LIKE '%VID_20200927_160455.mp4';"
41.111687|20.795396
antonio@asus:/tank/DOCKER_DATA/immich/upload$ cat library/antonio/2020/2020-09/VID_20200927_160455.mp4.xmp
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.84'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about=''
xmlns:exif='http://ns.adobe.com/exif/1.0/'>
<exif:GPSLatitude>40,59.472N</exif:GPSLatitude>
<exif:GPSLongitude>21,16.866E</exif:GPSLongitude>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
```
关闭于 3 天前 5 条评论