add upsert function to metedata
Merge branch 'fourq-metadata-sync-change' into metadata-sync-change