Replication Fundamentals in CouchDB Quiz Quiz

Explore the essential concepts of CouchDB replication with this quiz, featuring fundamental questions about replication types, benefits, conflicts, and key terms. Perfect for beginners seeking to reinforce their understanding of distributed databases and data synchronization.

  1. Understanding Replication Purpose

    Which of the following best describes the primary purpose of replication in CouchDB?

    1. To synchronize data between databases
    2. To increase the speed of queries
    3. To convert documents to XML format
    4. To permanently delete documents

    Explanation: Replication in CouchDB mainly synchronizes and copies data between two or more databases, ensuring that changes are reflected across all replicas. Query speed improvements, while possible through distribution, are not the central aim. Deleting documents or converting them to a different format, like XML, is not what replication does. Instead, replication keeps databases consistent and up-to-date.

  2. Replication Direction Types

    What is the difference between unidirectional and bidirectional replication in CouchDB?

    1. Unidirectional only deletes data; bidirectional only updates data
    2. Unidirectional converts data; bidirectional keeps data unchanged
    3. Unidirectional only pushes data; bidirectional pushes and pulls data
    4. Unidirectional uses less disk space; bidirectional uses more disk space

    Explanation: Unidirectional replication sends changes from a source database to a target, while bidirectional replication allows both databases to exchange and apply changes to each other. The process is not about deleting or only updating data, nor is it focused on disk space usage. Data conversion is not a replication direction feature.

  3. Default Data Format

    In CouchDB replication, which data format is typically used for document storage and transfer?

    1. YML
    2. CSV
    3. JSON
    4. XML

    Explanation: CouchDB stores and transfers documents in JSON format, which is lightweight and easily processed. CSV and XML are used in other contexts, but not as default formats for CouchDB documents. YML is a common typo for YAML, a different data format unrelated to default CouchDB storage.

  4. Replication Conflict Handling

    How does CouchDB typically handle replication conflicts when two documents have been updated independently?

    1. It overwrites one version without notice
    2. It deletes both conflicting documents
    3. It merges both documents automatically
    4. It creates a conflict and maintains both versions

    Explanation: CouchDB preserves both conflicted versions and allows an application or user to resolve the conflict manually. Overwriting without notice could cause data loss, and automatic merging is not supported out of the box due to potential ambiguity. Deleting both versions would eliminate data, which is not acceptable for conflict management.

  5. Primary Benefit of Replication

    Why is replication considered important in distributed databases like CouchDB?

    1. It prevents all security threats
    2. It increases file compression
    3. It changes the indexing strategy
    4. It ensures high availability and data redundancy

    Explanation: Replication is used mainly to provide high availability, ensuring that data remains accessible and safe if one node fails. While security is essential, replication alone does not protect against all threats. Compression and indexing are unrelated features not directly influenced by replication.

  6. Replication Trigger Methods

    Which of these is NOT a standard method for triggering replication in CouchDB?

    1. Manual request via an API
    2. Saving a document as a PDF
    3. Scheduled or continuous replication
    4. Using a replication document

    Explanation: Replication isn't initiated by saving a document as a PDF. Replication can be triggered manually using APIs, scheduled for specific times, set as continuous, or configured using replication documents. PDF saving is unrelated to replication processes.

  7. Understanding 'Checkpoint' in Replication

    What is a 'checkpoint' in the context of CouchDB replication?

    1. A saved position to resume replication later
    2. A place where database size is optimized
    3. A special view for faster searches
    4. A document type for admin access

    Explanation: A checkpoint records the progress of replication so it can resume from the correct position after interruption. It is not for database optimization, admin access, or search acceleration. The term specifically relates to tracking synchronization progress.

  8. Change Feed in Replication

    During replication, how does CouchDB know which documents have changed?

    1. By reading the access log
    2. By monitoring the changes feed
    3. By comparing indexes only
    4. By checking CSV exports

    Explanation: CouchDB uses the changes feed to keep track of document modifications for efficient replication. Access logs track HTTP requests but do not list database changes specifically. Indexes are not solely for tracking data changes, and CSV exports are irrelevant to replication tracking.

  9. Replication Filter Definition

    What is the primary purpose of a replication filter in CouchDB?

    1. To replicate only selected documents based on criteria
    2. To increase server RAM usage
    3. To create views automatically
    4. To encrypt all documents

    Explanation: Replication filters allow selective replication, restricting which documents get copied based on specified rules. They do not influence memory usage or encryption, nor are they used for view creation. This helps optimize replication for specific needs.

  10. Continuous vs. One-Time Replication

    What distinguishes continuous replication from a one-time replication in CouchDB?

    1. Continuous replication keeps updating as changes occur, while one-time replication runs only once
    2. Continuous replication deletes old data automatically, unlike one-time replication
    3. One-time replication uses a different data format
    4. Continuous replication requires double the network bandwidth

    Explanation: Continuous replication constantly monitors for changes and replicates them as soon as they appear, while one-time replication only synchronizes data once. Automatic data deletion and data format differences are inaccurate. Continuous replication may use more bandwidth over time, but it does not inherently require double the network resources for every situation.