One of the readers has taken pains to get a reference text in Mysuru, published in the year 1900!My gratitude to him. I am providing the communication from him
Though it is a Brahmin Gotra,it might have been modified as a Kshatriya Gotra because of change in Profession.
Viswamitra Gotra is a Brahmin Gotra .
But when Viswamitra became a Rajarishi and gave the Gayatri Mantra to the world his Gotra became Brahmin.
This system also takes into account instances when one has more than one wife. Over a period of time name of the benefactor is also included as Gotra,as a mark of Respect.
We spend so much for movies and entertainment.
Now to the issue on hand.
There is a group of Brahmins who accepted Dakshina from Lord Rama.
They were the priests who welcomed Lord Rama when he returned to Ayodhya after killing Ravana.
And over a period of years Brahmins have started using their professions as their surnames ,as against the Hindu practice of using Sharma as their surname and for indentification their Pravara/Abhivadan Mantra.
So when one has a surname like Upadhyaya it merely denotes the profession and not a caste.
To find it one has to check the Pravara.