Google Cloud Professional Data Engineer — Question 71
You have Google Cloud Dataflow streaming pipeline running with a Google Cloud Pub/Sub subscription as the source. You need to make an update to the code that will make the new Cloud Dataflow pipeline incompatible with the current version. You do not want to lose any data when making this update. What should you do?
Answer options
- A. Update the current pipeline and use the drain flag.
- B. Update the current pipeline and provide the transform mapping JSON object.
- C. Create a new pipeline that has the same Cloud Pub/Sub subscription and cancel the old pipeline.
- D. Create a new pipeline that has a new Cloud Pub/Sub subscription and cancel the old pipeline.
Correct answer: A
Explanation
The correct answer is A because using the drain flag allows the current pipeline to finish processing existing messages while preventing new messages from being processed, thus ensuring no data is lost during the update. Option B is incorrect as providing a transform mapping JSON object does not address the need to prevent data loss. Options C and D involve creating new pipelines, which could lead to data loss if the old pipeline is canceled before all messages are processed.