How exactly shuffle_size() affect the sampling of in tensorflow.Data.shuffle method and its relation to batch_size

Take this answer as the example. How the Dataset.shuffle shuffles the Dataset object, i.e., the array ["filename_00001.jpg", "filename_00002.jpg", ..., "filename_10001.jpg", "filename_10002.jpg", ...].

According the shuffle document, buffer_size represents the number of elements from this dataset from which the new dataset will sample. So, say, if we set buffer_size = 1000 for the above example, then the first minibatch is sampled from ["filename_00001.jpg",..., "filename_01000.jpg"], and then how the second minibatch is sampled? If batch_size>buffer_sizethen how Dataset.shuffle(buffer_size).repeat().batch(batch_size) samples minibatch exactly?